home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / arud220.lha / Arud220 / arud.s < prev   
Text File  |  1995-11-10  |  49KB  |  2,661 lines

  1. ;-----------------------------------------------------------------------------
  2. ; Arud Converter v2.1
  3. ; by Morten Amundsen
  4. ;
  5. ; start: Monday, 16/10 1995, 09:46 PM
  6. ;   end: Sunday, 22/10 1995, 02:34 PM
  7. ;
  8. ; Arud Converter V2.01
  9. ; (Rename .info file also, if they exists)
  10. ;
  11. ; start: Friday, 27/10 1995, 04:09 PM
  12. ;   end: Friday, 27/10 1995, 04:24 PM
  13. ;
  14. ; Arud Converter V2.1
  15. ; (Add a gadget to reverse the order of renaming)
  16. ;
  17. ; start: Monday, 06/11 1995, 21:33
  18. ;   end: Monday, 06/11 1995, 22:02
  19. ;
  20. ; Arud Converter V2.2
  21. ; (Added the option of either renaming, copying or copying to a specified
  22. ;  directory plus "Places needed" now also shows max number of places
  23. ;  used in number sequence.)
  24. ;
  25. ; start: Thursday, 09/11 1995, 20:27
  26. ;   end: Friday, 10/11 1995, 14:08
  27. ;
  28. ; Assembled in PhxAss 4.23
  29. ;-----------------------------------------------------------------------------
  30.  
  31. VERSION    = 39                        ; kick version
  32. WB    = 1                        ; wb startup (0=no)
  33.  
  34. ;-----------------------------------------------------------------------------
  35.  
  36. NAME:    MACRO
  37.     dc.b    "arud "
  38.     ENDM
  39.  
  40. VER:    MACRO
  41.     dc.b    "2"
  42.     ENDM
  43.  
  44. REV:    MACRO
  45.     dc.b    "2"
  46.     ENDM
  47.  
  48. DATE:    MACRO
  49.     dc.b    "(10.11.95)"
  50.     ENDM
  51.  
  52. VERSTR:    MACRO
  53.     dc.b    "$VER: "
  54.     NAME
  55.     VER
  56.     dc.b    "."
  57.     REV
  58.     dc.b    " by Morten Amundsen "
  59.     DATE
  60.     dc.b    10,13,0
  61.     ENDM
  62.  
  63. ;-----------------------------------------------------------------------------
  64.  
  65.     include    "misc/lvooffsets.i"
  66.     include    "misc/macros.i"
  67.     include    "graphics/gfxbase.i"
  68.     include    "dos/dosextens.i"
  69.     include    "intuition/intuition.i"
  70.     include    "libraries/gadtools.i"
  71.     include    "libraries/reqtools.i"
  72.     include    "exec/memory.i"
  73.  
  74.     XDEF    _main
  75.     XDEF    _DOSBase
  76.     XDEF    _GfxBase
  77.     XDEF    _IntuitionBase
  78.     XDEF    _GadToolsBase
  79.     XDEF    _ReqToolsBase
  80.  
  81. ;-----------------------------------------------------------------------------
  82.  
  83. MAGIC:        equ    5        ; "magic" pixel value
  84.  
  85. GAD_PBUTTON:    equ    0
  86. GAD_PSTRING:    equ    1
  87. GAD_BASETEXT:    equ    2
  88. GAD_REQPLACE:    equ    3
  89. GAD_NOFILES:    equ    4
  90. GAD_RANGE:    equ    5
  91. GAD_NEWBASE:    equ    6
  92. GAD_PLACES:    equ    7
  93. GAD_STARTVAL:    equ    8
  94. GAD_LEADING:    equ    9
  95. GAD_CONVERT:    equ    10
  96. GAD_QUIT:    equ    11
  97. GAD_FORCE:    equ    12
  98. GAD_DIRECTION:    equ    13
  99. GAD_ACTION:    equ    14
  100. GAD_PLACEUSE:    equ    15
  101. SUMGAD:        equ    16        ; number of gadgets
  102.  
  103. PATHLEN:    equ    128        ; no. of chars in path
  104. BASELEN:    equ    20        ; no. of chars in base
  105. PLACESLEN:    equ    10        ; max no of numbers in integer.
  106.                     ; BASELEN+PLACESLEN should equal 30
  107.  
  108. FILELEN:    equ    30        ; length of filename
  109. PCALCLEN:    equ    40        ; no of chars to calc window width
  110.  
  111.  STRUCTURE    ArudFile,0
  112.     STRUCT    af_Node,MLN_SIZE
  113.     APTR    af_Name
  114.     ULONG    af_Count
  115.     LABEL    af_SIZEOF
  116.  
  117. ;-----------------------------------------------------------------------------
  118.  
  119. _main:    movem.l    d0-d7/a0-a6,-(a7)
  120.  
  121.     IFD    WB
  122.     bsr.w    FIND_WBMSG
  123.     ENDC
  124.  
  125.     lea    ArudList,a0
  126.     NEWLIST    a0
  127.  
  128.     OPENLIB    DOSName,VERSION,_DOSBase
  129.     beq.s    EXIT
  130.     OPENLIB    GfxName,VERSION,_GfxBase
  131.     beq.s    EXIT
  132.     OPENLIB    IntuitionName,VERSION,_IntuitionBase
  133.     beq.s    EXIT
  134.     OPENLIB    GadToolsName,VERSION,_GadToolsBase
  135.     beq.s    EXIT
  136.     OPENLIB    ReqToolsName,38,_ReqToolsBase
  137.     beq.s    EXIT
  138.  
  139.     moveq    #RT_REQINFO,d0
  140.     sub.l    a0,a0
  141.     CALL    rtAllocRequestA,_ReqToolsBase
  142.     move.l    d0,_InfoReq
  143.     beq.s    EXIT
  144.  
  145.     moveq    #RT_FILEREQ,d0
  146.     sub.l    a0,a0
  147.     CALL    rtAllocRequestA,_ReqToolsBase
  148.     move.l    d0,_FileReq
  149.     beq.s    EXIT
  150.  
  151. ; get initial values (fontheight, fontwidth and titleheight) from WB screen.
  152.  
  153.     lea    WorkbenchName,a0
  154.     CALL    LockPubScreen,_IntuitionBase
  155.     move.l    d0,_WBScr
  156.     beq.s    EXIT
  157.  
  158.     move.w    #1,WBLock
  159.  
  160.     move.l    d0,a0
  161.     move.l    sc_Font(a0),a0
  162.     bsr.w    GET_FONT_DATA
  163.     beq.s    EXIT
  164.  
  165.     moveq    #0,d0
  166.     move.l    _WBScr,a0
  167.     move.b    sc_BarHeight(a0),d0
  168.     move.w    d0,TitleHeight
  169.  
  170.     sub.l    a1,a1
  171.     CALL    GetVisualInfoA,_GadToolsBase
  172.     move.l    d0,d7
  173.  
  174.     lea    WorkbenchName,a0
  175.     CALL    UnlockPubScreen,_IntuitionBase
  176.  
  177.     clr.w    WBLock
  178.  
  179.     move.l    d7,_VisualInfo
  180.     beq.s    EXIT
  181.  
  182. ; set VisualInfo in bevelbox taglist
  183.  
  184.     SETTAG    #BevelTags,GT_VisualInfo,d7
  185.  
  186. ; calc window height & width
  187.  
  188.     move.w    TitleHeight,d0
  189.     move.w    GadgetHeight,d1
  190.     mulu    #11,d1            ; 11 lines of gadgets
  191.     add.w    d1,d0
  192.     add.w    #MAGIC*16,d0        ; "magic" space between gads
  193.     move.w    d0,WindowHeight
  194.  
  195.     move.l    _WBScr,a0
  196.     move.w    sc_Height(a0),d1    ; if window is higher than screen...
  197.     cmp.w    d0,d1
  198.     bge.s    OK_HEIGHT
  199.  
  200.     move.l    _Font,a1
  201.     CALL    CloseFont,_GfxBase
  202.     move.l    #0,_Font
  203.  
  204.     lea    TopazAttr,a0        ; ...adjust to topaz.font 8
  205.     bsr.w    GET_FONT_DATA
  206.     beq.w    EXIT
  207.  
  208.     move.w    TitleHeight,d0
  209.     move.w    GadgetHeight,d1
  210.     mulu    #11,d1            ; 11 lines of gadgets
  211.     add.w    d1,d0
  212.     add.w    #MAGIC*16,d0
  213.     move.w    d0,WindowHeight
  214.  
  215. OK_HEIGHT:
  216.     lea    PCalcIT,a0
  217.     move.l    _TextAttr,it_ITextFont(a0)
  218.     CALL    IntuiTextLength,_IntuitionBase
  219.     add.w    #MAGIC*2,d0
  220.     move.w    d0,WindowWidth
  221.  
  222. ;---------------------------------------------------------------------
  223. ; calc all gadget positions
  224.  
  225. ;-----------------
  226. ; PATH button
  227. ;-----------------
  228.  
  229.     lea    ForceIT,a0
  230.     move.l    _TextAttr,it_ITextFont(a0)
  231.     CALL    IntuiTextLength,_IntuitionBase
  232.  
  233.     lea    PButtonS,a0
  234.     add.w    #MAGIC*2,d0
  235.     move.w    d0,gng_Width(a0)
  236.     move.w    #MAGIC*2,gng_LeftEdge(a0)
  237.     move.w    TitleHeight,d0
  238.     add.w    #MAGIC,d0
  239.     move.w    d0,gng_TopEdge(a0)
  240.     move.w    GadgetHeight,gng_Height(a0)
  241.     move.w    FontWidth,d0
  242.  
  243. ;----------------
  244. ; PATH string
  245. ;----------------
  246.  
  247.     lea    PStringS,a0            ; 'Path' string
  248.     move.w    TitleHeight,d0
  249.     add.w    #MAGIC,d0
  250.     move.w    d0,gng_TopEdge(a0)
  251.     move.w    GadgetHeight,gng_Height(a0)
  252.  
  253.     lea    PButtonS,a1
  254.     move.w    gng_Width(a1),d0
  255.     move.w    d0,d1
  256.     add.w    #MAGIC*3,d1
  257.     move.w    d1,gng_LeftEdge(a0)
  258.  
  259.     move.w    WindowWidth,d0
  260.     sub.w    d1,d0
  261.     sub.w    #MAGIC*2,d0
  262.     move.w    d0,gng_Width(a0)
  263.  
  264. ;---------------------------------------------------------------------
  265. ; BASENAME text
  266. ;------------------
  267.  
  268.     lea    BaseTextS,a0
  269.     move.w    TitleHeight,d0
  270.     add.w    GadgetHeight,d0
  271.     add.w    #MAGIC*3,d0
  272.     move.w    d0,gng_TopEdge(a0)
  273.     move.w    WindowWidth,d0
  274.     lsr.w    #1,d0
  275.     move.w    d0,gng_LeftEdge(a0)
  276.     sub.w    #MAGIC*4,d0
  277.     move.w    d0,gng_Width(a0)
  278.     move.w    GadgetHeight,gng_Height(a0)
  279.  
  280. ;---------------------------------------------------------------------
  281. ; REQPLACE number
  282. ;------------------
  283.  
  284.     lea    ReqPlaceS,a0
  285.     move.w    TitleHeight,d0
  286.     move.w    GadgetHeight,d1
  287.     lsl.w    #1,d1
  288.     add.w    d1,d0
  289.     add.w    #MAGIC*4,d0
  290.     move.w    d0,gng_TopEdge(a0)
  291.     move.w    WindowWidth,d0
  292.     lsr.w    #1,d0
  293.     move.w    d0,gng_LeftEdge(a0)
  294.     move.w    d0,d7
  295.     sub.w    #MAGIC*4,d0
  296.     lsr.w    #1,d0
  297.     sub.w    #MAGIC,d0
  298.     move.w    d0,gng_Width(a0)
  299.     move.w    d0,d6
  300.     add.w    d0,d7
  301.     move.w    GadgetHeight,gng_Height(a0)
  302.  
  303. ;--------------------------------------------------------------------
  304. ; PLACESUSED number
  305. ;-----------------------
  306.  
  307.     lea    PlaceUseS,a0
  308.     move.w    TitleHeight,d0
  309.     move.w    GadgetHeight,d1
  310.     lsl.w    #1,d1
  311.     add.w    d1,d0
  312.     add.w    #MAGIC*4,d0
  313.     move.w    d0,gng_TopEdge(a0)
  314.     add.w    #MAGIC*2,d7
  315.     move.w    d7,gng_LeftEdge(a0)
  316.     move.w    d6,gng_Width(a0)
  317.     move.w    GadgetHeight,gng_Height(a0)
  318.  
  319. ;---------------------------------------------------------------------
  320. ; NOFILES number
  321. ;------------------
  322.  
  323.     lea    NoFilesS,a0
  324.     move.w    TitleHeight,d0
  325.     move.w    GadgetHeight,d1
  326.     mulu    #3,d1
  327.     add.w    d1,d0
  328.     add.w    #MAGIC*5,d0
  329.     move.w    d0,gng_TopEdge(a0)
  330.     move.w    WindowWidth,d0
  331.     lsr.w    #1,d0
  332.     move.w    d0,gng_LeftEdge(a0)
  333.     sub.w    #MAGIC*4,d0
  334.     move.w    d0,gng_Width(a0)
  335.     move.w    GadgetHeight,gng_Height(a0)
  336.  
  337. ;---------------------------------------------------------------------
  338. ; RANGE text
  339. ;------------------
  340.  
  341.     lea    RangeS,a0
  342.     move.w    TitleHeight,d0
  343.     move.w    GadgetHeight,d1
  344.     lsl.w    #2,d1
  345.     add.w    d1,d0
  346.     add.w    #MAGIC*6,d0
  347.     move.w    d0,gng_TopEdge(a0)
  348.     move.w    WindowWidth,d0
  349.     lsr.w    #1,d0
  350.     move.w    d0,gng_LeftEdge(a0)
  351.     sub.w    #MAGIC*4,d0
  352.     move.w    d0,gng_Width(a0)
  353.     move.w    GadgetHeight,gng_Height(a0)
  354.  
  355. ;---------------------------------------------------------------------
  356. ; NEWBASE string
  357. ;------------------
  358.  
  359.     lea    NewBaseS,a0
  360.     move.w    TitleHeight,d0
  361.     move.w    GadgetHeight,d1
  362.     mulu    #5,d1
  363.     add.w    d1,d0
  364.     add.w    #MAGIC*9,d0
  365.     move.w    d0,gng_TopEdge(a0)
  366.     move.w    d0,d7
  367.     move.w    WindowWidth,d0
  368.     lsr.w    #1,d0
  369.     move.w    d0,gng_LeftEdge(a0)
  370.     sub.w    #MAGIC*4,d0
  371.     move.w    d0,gng_Width(a0)
  372.     move.w    GadgetHeight,gng_Height(a0)
  373.  
  374. ;------------------
  375. ; FORCE cycle
  376. ;------------------
  377.  
  378.     lea    ForceIT,a0
  379.     move.l    _TextAttr,it_ITextFont(a0)
  380.     CALL    IntuiTextLength,_IntuitionBase
  381.  
  382.     lea    ForceS,a0
  383.     add.w    #MAGIC*2,d0
  384.     add.w    #32,d0
  385.     move.w    d0,gng_Width(a0)
  386.     move.w    d7,gng_TopEdge(a0)
  387.     move.w    #MAGIC*3,gng_LeftEdge(a0)
  388.     move.w    GadgetHeight,gng_Height(a0)
  389.  
  390. ;---------------------------------------------------------------------
  391. ; PLACES integer
  392. ;------------------
  393.  
  394.     lea    PlacesS,a0
  395.     move.w    TitleHeight,d0
  396.     move.w    GadgetHeight,d1
  397.     mulu    #6,d1
  398.     add.w    d1,d0
  399.     add.w    #MAGIC*10,d0
  400.     move.w    d0,gng_TopEdge(a0)
  401.     move.w    WindowWidth,d0
  402.     lsr.w    #1,d0
  403.     move.w    d0,gng_LeftEdge(a0)
  404.     sub.w    #MAGIC*4,d0
  405.     move.w    d0,gng_Width(a0)
  406.     move.w    GadgetHeight,gng_Height(a0)
  407.  
  408. ;---------------------------------------------------------------------
  409. ; STARTVAL integer
  410. ;------------------
  411.  
  412.     lea    StartValS,a0
  413.     move.w    TitleHeight,d0
  414.     move.w    GadgetHeight,d1
  415.     mulu    #7,d1
  416.     add.w    d1,d0
  417.     add.w    #MAGIC*11,d0
  418.     move.w    d0,gng_TopEdge(a0)
  419.     move.w    WindowWidth,d0
  420.     lsr.w    #1,d0
  421.     move.w    d0,gng_LeftEdge(a0)
  422.     sub.w    #MAGIC*4,d0
  423.     move.w    d0,gng_Width(a0)
  424.     move.w    GadgetHeight,gng_Height(a0)
  425.  
  426. ;---------------------------------------------------------------------
  427. ; LEADING cycle
  428. ;------------------
  429.  
  430.     lea    LeadingS,a0
  431.     move.w    TitleHeight,d0
  432.     move.w    GadgetHeight,d1
  433.     mulu    #8,d1
  434.     add.w    d1,d0
  435.     add.w    #MAGIC*13,d0
  436.     move.w    d0,gng_TopEdge(a0)
  437.     move.w    #MAGIC*2,gng_LeftEdge(a0)
  438.     move.w    WindowWidth,d0
  439.     sub.w    #MAGIC*4,d0
  440.     move.w    d0,gng_Width(a0)
  441.     move.w    GadgetHeight,gng_Height(a0)
  442.  
  443. ;--------------------------------------------------------------------
  444. ; DIRECTION cycle
  445. ;-----------------------
  446.  
  447.     lea    DirectionS,a0
  448.     move.w    TitleHeight,d0
  449.     move.w    GadgetHeight,d1
  450.     mulu    #9,d1
  451.     add.w    d1,d0
  452.     add.w    #MAGIC*14,d0
  453.     move.w    d0,gng_TopEdge(a0)
  454.     move.w    #MAGIC*2,gng_LeftEdge(a0)
  455.     move.w    WindowWidth,d0
  456.     sub.w    #MAGIC*4,d0
  457.     move.w    d0,gng_Width(a0)
  458.     move.w    GadgetHeight,gng_Height(a0)
  459.  
  460. ;---------------------------------------------------------------------
  461. ; CONVERT button
  462. ;------------------
  463.  
  464.     lea    ConvertS,a0
  465.     move.w    TitleHeight,d0
  466.     move.w    GadgetHeight,d1
  467.     mulu    #10,d1
  468.     add.w    d1,d0
  469.     add.w    #MAGIC*15,d0
  470.     move.w    d0,gng_TopEdge(a0)
  471.     move.w    #MAGIC*2,gng_LeftEdge(a0)
  472.     move.w    WindowWidth,d0
  473.     lsr.w    #2,d0
  474.     move.w    d0,gng_Width(a0)
  475.     move.w    d0,d7
  476.     move.w    GadgetHeight,gng_Height(a0)
  477.  
  478. ;---------------------------------------------------------------------
  479. ; QUIT button
  480. ;------------------
  481.  
  482.     lea    QuitS,a0
  483.     move.w    TitleHeight,d0
  484.     move.w    GadgetHeight,d1
  485.     mulu    #10,d1
  486.     add.w    d1,d0
  487.     add.w    #MAGIC*15,d0
  488.     move.w    d0,gng_TopEdge(a0)
  489.     move.w    WindowWidth,d0
  490.     move.w    d0,d1
  491.     lsr.w    #2,d0
  492.     move.w    d0,gng_Width(a0)
  493.     sub.w    d0,d1
  494.     sub.w    #MAGIC*2,d1
  495.     move.w    d1,gng_LeftEdge(a0)
  496.     move.w    GadgetHeight,gng_Height(a0)
  497.  
  498. ;--------------------------------------------------------------------
  499. ; ACTION cycle
  500. ;-----------------------
  501.  
  502.     lea    ActionS,a0
  503.     move.w    TitleHeight,d0
  504.     move.w    GadgetHeight,d1
  505.     mulu    #10,d1
  506.     add.w    d1,d0
  507.     add.w    #MAGIC*15,d0
  508.     move.w    d0,gng_TopEdge(a0)
  509.     move.w    GadgetHeight,gng_Height(a0)
  510.     move.w    d7,d6
  511.     add.w    #MAGIC*3,d6
  512.     move.w    d6,gng_LeftEdge(a0)
  513.     add.w    d7,d7
  514.     add.w    #MAGIC*6,d7
  515.     move.w    WindowWidth,d6
  516.     sub.w    d7,d6
  517.     move.w    d6,gng_Width(a0)
  518.  
  519. ;----------------------------------------------------------------------
  520. ; setup gadgets
  521.  
  522.     lea    _Gad,a0
  523.     CALL    CreateContext,_GadToolsBase
  524.     tst.l    d0
  525.     beq.s    EXIT
  526.  
  527.     lea    GadgetTags,a3
  528.     lea    GadgetTypes,a4
  529.     lea    GadgetStructs,a5
  530.  
  531.     lea    GadgetList,a6
  532. GADGET_LOOP:
  533.     move.l    d0,a0
  534.     beq.s    EXIT
  535.  
  536.     move.l    (a5)+,a1
  537.     cmp.l    #NULL,a1
  538.     beq.s    GADGETS_DONE
  539.  
  540.     move.l    _TextAttr,gng_TextAttr(a1)
  541.     move.l    _VisualInfo,gng_VisualInfo(a1)
  542.  
  543.     move.l    (a4)+,d0
  544.     move.l    (a3)+,a2
  545.  
  546.     move.l    a6,-(a7)
  547.     CALL    CreateGadgetA,_GadToolsBase
  548.     move.l    (a7)+,a6
  549.  
  550.     move.l    d0,(a6)+
  551.     bra.s    GADGET_LOOP
  552.  
  553. ; open window
  554.  
  555. GADGETS_DONE:
  556.     SETTAG    #NewWindowTags,WA_Gadgets,_Gad
  557.  
  558.     moveq    #0,d7
  559.     move.w    WindowHeight,d7
  560.     SETTAG    #NewWindowTags,WA_Height,d7
  561.  
  562.     move.w    WindowWidth,d7
  563.     SETTAG    #NewWindowTags,WA_Width,d7
  564.  
  565.     sub.l    a0,a0
  566.     lea    NewWindowTags,a1
  567.     CALL    OpenWindowTagList,_IntuitionBase
  568.     move.l    d0,_Window
  569.     beq.s    EXIT
  570.  
  571.     move.l    d0,a1
  572.     move.l    wd_RPort(a1),a1
  573.     move.l    _Font,a0
  574.     CALL    SetFont,_GfxBase    
  575.  
  576.     bsr.w    REFRESH_WINDOW
  577.  
  578.     SETTAG    #FileReqTags,RT_Window,_Window
  579.     SETTAG    #EZReqTags,RT_Window,_Window
  580.  
  581. ;--------------------------------------------------------------------------
  582.  
  583.     move.l    _Window,a0
  584.     move.l    wd_UserPort(a0),a0
  585.     move.l    a0,_UserPort
  586.  
  587. MAINLOOP:
  588.     tst.w    ExitFlag
  589.     bne.s    EXIT
  590.  
  591.     move.l    _UserPort,a0
  592.     EXEC    WaitPort
  593.  
  594. MSGLOOP:
  595.     move.l    _UserPort,a0
  596.     CALL    GT_GetIMsg,_GadToolsBase
  597.     move.l    d0,_Message
  598.     beq.s    MAINLOOP
  599.  
  600.     move.l    d0,a0
  601.     move.l    im_Class(a0),d0
  602.  
  603.     cmp.l    #IDCMP_CLOSEWINDOW,d0
  604.     bne.s    NO_CLOSEWINDOW
  605.  
  606.     move.w    #1,ExitFlag
  607.     bra.s    REPLYMSG
  608.  
  609. NO_CLOSEWINDOW:
  610.     cmp.l    #IDCMP_GADGETUP,d0
  611.     bne.s    REPLYMSG
  612.  
  613.     moveq    #0,d0
  614.     move.l    im_IAddress(a0),a1
  615.     move.w    gg_GadgetID(a1),d0
  616.     lsl.w    #2,d0
  617.     lea    SubJumpTable,a2
  618.     move.l    (a2,d0.w),a2
  619.     jsr    (a2)
  620.  
  621. REPLYMSG:
  622.     move.l    _Message,a1
  623.     CALL    GT_ReplyIMsg,_GadToolsBase
  624.     bra.s    MSGLOOP
  625.  
  626. EXIT:    bsr.s    CLEAN
  627.     movem.l    (a7)+,d0-d7/a0-a6
  628.     moveq    #0,d0
  629.     rts
  630.  
  631. ;-----------------------------------------------------------------------------
  632.  
  633. CLEAN:
  634.     bsr.w    UNLOCK_WB
  635.  
  636.     bsr.s    CLOSE_WINDOW
  637.  
  638.     bsr.s    SET_PROGDIR
  639.     bsr.s    FREE_FIB
  640.     bsr.s    FREE_LIST
  641.     bsr.w    FREE_FILEBUFFER
  642.  
  643.     bsr.w    CLOSEREQ
  644.     bsr.w    CLOSEGAD
  645.     bsr.w    CLOSEINT
  646.     bsr.w    CLOSEGFX
  647.     bsr.w    CLOSEDOS
  648.  
  649.     IFD    WB
  650.     bsr.w    REPLY_WBMSG
  651.     ENDC
  652.     rts
  653.  
  654. ;------------------------------------------------------------------------
  655.  
  656. UNLOCK_WB:
  657.     tst.w    WBLock
  658.     beq.s    .NOT
  659.  
  660.     lea    WorkbenchName,a0
  661.     CALL    UnlockPubScreen,_IntuitionBase
  662. .NOT:    rts
  663.  
  664. CLOSE_WINDOW:
  665.     tst.l    _Window
  666.     beq.s    .NOT1
  667.  
  668.     move.l    _Window,a0
  669.     CALL    CloseWindow,_IntuitionBase
  670.  
  671. .NOT1:    tst.l    _Gad
  672.     beq.s    .NOT2
  673.  
  674.     move.l    _Gad,a0
  675.     CALL    FreeGadgets,_GadToolsBase
  676.  
  677. .NOT2:    tst.l    _Font
  678.     beq.s    .NOT3
  679.  
  680.     move.l    _Font,a1
  681.     CALL    CloseFont,_GfxBase
  682.  
  683. .NOT3:    tst.l    _VisualInfo
  684.     beq.s    .NOT4
  685.  
  686.     move.l    _VisualInfo,a0
  687.     CALL    FreeVisualInfo,_GadToolsBase
  688. .NOT4:    rts
  689.  
  690. ;------------------------------------------------------------------------
  691.  
  692. SET_PROGDIR:
  693.     tst.w    CurrentDone
  694.     beq.s    .NOT1
  695.  
  696.     move.l    _OldCurrent,d1
  697.     CALL    CurrentDir,_DOSBase
  698.  
  699. .NOT1:    tst.l    _CDLock
  700.     beq.s    .NOT2
  701.  
  702.     move.l    _CDLock,d1
  703.     CALL    UnLock,_DOSBase
  704. .NOT2:    rts
  705.  
  706. ;------------------------------------------------------------------------
  707.  
  708. FREE_FIB:
  709.     tst.l    _FIB
  710.     beq.s    .NOT
  711.  
  712.     moveq    #DOS_FIB,d1
  713.     move.l    _FIB,d2
  714.     CALL    FreeDosObject,_DOSBase
  715.     move.l    #0,_FIB
  716. .NOT:    rts
  717.  
  718. ;------------------------------------------------------------------------
  719.  
  720. FREE_LIST:
  721.     lea    ArudList,a0
  722.     TSTLIST    a0
  723.     beq.s    .EMPTY
  724.  
  725. .LOOP:    lea    ArudList,a0
  726.     TSTNODE    a0,a1
  727.     beq.s    .DONE
  728.  
  729.     move.l    a1,a2
  730.     REMOVE
  731.  
  732.     move.l    af_Name(a2),d3
  733.     tst.l    d3
  734.     beq.s    .NODE
  735.  
  736.     move.l    d3,a1
  737.     EXEC    FreeVec            ; free name
  738.  
  739. .NODE:    move.l    a2,a1
  740.     EXEC    FreeVec            ; free node
  741.     bra.s    .LOOP
  742.  
  743. .DONE:    lea    ArudList,a0
  744.     NEWLIST    a0
  745. .EMPTY:    rts
  746.  
  747. ;--------------------------------------------------------------------------
  748.  
  749. CLOSEREQ:
  750.     tst.l    _FileReq
  751.     beq.s    .NOT1
  752.  
  753.     move.l    _FileReq,a1
  754.     CALL    rtFreeRequest,_ReqToolsBase
  755.  
  756. .NOT1:    tst.l    _InfoReq
  757.     beq.s    .NOT2
  758.  
  759.     move.l    _InfoReq,a1
  760.     CALL    rtFreeRequest,_ReqToolsBase
  761.  
  762. .NOT2:    tst.l    _ReqToolsBase
  763.     beq.s    .NOT3
  764.  
  765.     CLOSELIB _ReqToolsBase
  766. .NOT3:    rts
  767.  
  768. CLOSEGAD:
  769.     tst.l    _GadToolsBase
  770.     beq.s    .NOT
  771.  
  772.     CLOSELIB _GadToolsBase
  773. .NOT:    rts
  774.  
  775. CLOSEINT:
  776.     tst.l    _IntuitionBase
  777.     beq.s    .NOT
  778.  
  779.     CLOSELIB _IntuitionBase
  780. .NOT:    rts
  781.  
  782. CLOSEDOS:
  783.     tst.l    _DOSBase
  784.     beq.s    .NOT
  785.  
  786.     CLOSELIB _DOSBase
  787. .NOT:    rts
  788.  
  789. CLOSEGFX:
  790.     tst.l    _GfxBase
  791.     beq.s    .NOT
  792.  
  793.     CLOSELIB _GfxBase
  794. .NOT:    rts
  795.  
  796. ;----------------------------------------------------------------------------
  797.  
  798.     IFD    WB
  799. FIND_WBMSG:
  800.     sub.l    a1,a1
  801.     EXEC    FindTask
  802.     move.l    d0,a4
  803.  
  804.     moveq    #0,d0
  805.  
  806.     tst.l    pr_CLI(a4)
  807.     bne.s    .CLI
  808.  
  809.     lea    pr_MsgPort(a4),a0
  810.     EXEC    WaitPort
  811.     lea    pr_MsgPort(a4),a0
  812.     EXEC    GetMsg
  813. .CLI:    move.l    d0,_WBMsg
  814.     rts
  815.  
  816. REPLY_WBMSG:
  817.     tst.l    _WBMsg
  818.     beq.s    .NOT
  819.  
  820.     EXEC    Forbid
  821.     move.l    _WBMsg,a1
  822.     EXEC    ReplyMsg
  823.     EXEC    Permit
  824. .NOT:    rts
  825.     ENDC
  826.  
  827. ;-----------------------------------------------------------------------------
  828.  
  829. GET_FONT_DATA:
  830.     move.l    a0,_TextAttr
  831.     CALL    OpenFont,_GfxBase
  832.     move.l    d0,_Font
  833.     beq.s    .EXIT
  834.  
  835.     move.l    d0,a0
  836.     move.w    tf_YSize(a0),FontHeight
  837.     move.w    tf_XSize(a0),FontWidth
  838.  
  839.     move.w    FontHeight,d0
  840.     add.w    #MAGIC*2,d0
  841.     move.w    d0,GadgetHeight
  842.  
  843.     moveq    #1,d0
  844. .EXIT:    rts
  845.  
  846. ;-------------------------------------------------------------------------
  847.  
  848. REFRESH_WINDOW:
  849.     move.l    _Window,a0
  850.     sub.l    a1,a1
  851.     CALL    GT_RefreshWindow,_GadToolsBase
  852.  
  853.     bsr.w    RENDER_BEVELBOXES
  854.     rts
  855.  
  856. RENDER_BEVELBOXES:
  857.     move.l    _Window,a0
  858.     move.l    wd_RPort(a0),a0
  859.     lea    BevelTags,a1
  860.     moveq    #MAGIC,d0
  861.     move.w    TitleHeight,d1
  862.     add.w    GadgetHeight,d1
  863.     add.w    #MAGIC*2,d1
  864.     move.w    WindowWidth,d2
  865.     sub.w    #MAGIC*2,d2
  866.     move.w    GadgetHeight,d3
  867.     lsl.w    #2,d3
  868.     add.w    #MAGIC*5,d3
  869.     add.w    #MAGIC/2,d3
  870.     move.w    d3,d4
  871.     add.w    d1,d4
  872.     CALL    DrawBevelBoxA,_GadToolsBase
  873.  
  874.     move.l    _Window,a0
  875.     move.l    wd_RPort(a0),a0
  876.     lea    BevelTags,a1
  877.     moveq    #MAGIC,d0
  878.     move.w    d4,d1
  879.     addq.w    #1,d1
  880.     move.w    WindowWidth,d2
  881.     sub.w    #MAGIC*2,d2
  882.     move.w    GadgetHeight,d3
  883.     mulu    #3,d3
  884.     add.w    #MAGIC*5,d3
  885.     sub.w    #MAGIC/2,d3
  886.     CALL    DrawBevelBoxA,_GadToolsBase
  887.     rts    
  888.  
  889. ;-----------------------------------------------------------------------------
  890.  
  891. NO_OP:    rts
  892.  
  893. ;-----------------------------------------------------------------------------
  894.  
  895. PATH_BUTTON:
  896.     bsr.w    ALL_GADS_OFF
  897.  
  898.     move.l    _FileReq,a1
  899.     sub.l    a2,a2
  900.     lea    ArudTitle,a3
  901.     lea    FileReqTags,a0
  902.     CALL    rtFileRequestA,_ReqToolsBase
  903.     tst.l    d0
  904.     beq.s    NO_PATHB
  905.  
  906.     move.l    _FileReq,a0
  907.     move.l    rtfi_Dir(a0),a0        ; copy result to buffer
  908.     lea    PathString,a1
  909.     move.w    #PATHLEN-1,d7
  910. .LOOP:    move.b    (a0)+,(a1)+
  911.     beq.s    .DONE
  912.     dbf    d7,.LOOP
  913.  
  914. .DONE:    moveq    #GAD_PSTRING,d0        ; put pathname in string-gadget
  915.     lsl.w    #2,d0
  916.     lea    GadgetList,a0
  917.     move.l    (a0,d0.w),a0
  918.     move.l    _Window,a1
  919.     sub.l    a2,a2
  920.     lea    PStringTags,a3
  921.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  922.  
  923.     move.l    #PathString,d7
  924.     bsr.s    CURRENT_DIRECTORY
  925.  
  926.     bsr.w    BUILD_STRUCTURE
  927.     beq.s    NO_PATHB
  928.  
  929.     moveq    #GAD_BASETEXT,d0
  930.     lsl.w    #2,d0
  931.     lea    GadgetList,a0
  932.     move.l    (a0,d0.w),a0
  933.     move.l    _Window,a1
  934.     sub.l    a2,a2
  935.     lea    BaseTextTags,a3
  936.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  937.  
  938.     move.l    NoFiles,d7
  939.     SETTAG    #NoFilesTags,GTNM_Number,d7
  940.  
  941.     moveq    #GAD_NOFILES,d0
  942.     lsl.w    #2,d0
  943.     lea    GadgetList,a0
  944.     move.l    (a0,d0.w),a0
  945.     move.l    _Window,a1
  946.     sub.l    a2,a2
  947.     lea    NoFilesTags,a3
  948.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  949.  
  950.     SETTAG    #ReqPlaceTags,GTNM_Number,ReqPlaceLow
  951.  
  952.     moveq    #GAD_REQPLACE,d0
  953.     lsl.w    #2,d0
  954.     lea    GadgetList,a0
  955.     move.l    (a0,d0.w),a0
  956.     move.l    _Window,a1
  957.     sub.l    a2,a2
  958.     lea    ReqPlaceTags,a3
  959.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  960.  
  961.     SETTAG    #PlaceUseTags,GTNM_Number,PlacesUsed
  962.  
  963.     moveq    #GAD_PLACEUSE,d0
  964.     lsl.w    #2,d0
  965.     lea    GadgetList,a0
  966.     move.l    (a0,d0.w),a0
  967.     move.l    _Window,a1
  968.     sub.l    a2,a2
  969.     lea    PlaceUseTags,a3
  970.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  971.  
  972.     moveq    #GAD_RANGE,d0
  973.     lsl.w    #2,d0
  974.     lea    GadgetList,a0
  975.     move.l    (a0,d0.w),a0
  976.     move.l    _Window,a1
  977.     sub.l    a2,a2
  978.     lea    RangeTags,a3
  979.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  980. NO_PATHB:
  981.     bsr.w    ALL_GADS_ON
  982.     rts
  983.  
  984. ;------------------------------------------------------------------------
  985.  
  986. PATH_STRING:
  987.     move.l    gg_SpecialInfo(a1),a2
  988.     move.l    si_Buffer(a2),d7
  989.     bsr.s    CURRENT_DIRECTORY
  990.     beq.s    PS_FAIL
  991.  
  992.     move.l    d7,a0
  993.     lea    PathString,a1
  994.     move.w    #PATHLEN-1,d7
  995. .LOOP:    move.b    (a0)+,(a1)+
  996.     beq.s    .DONE
  997.     dbf    d7,.LOOP
  998.  
  999. .DONE:    move.l    _FileReq,a1
  1000.     lea    ChangeDirTags,a0
  1001.     CALL    rtChangeReqAttrA,_ReqToolsBase
  1002.  
  1003. MAIN_BSTRUCT:
  1004.     bsr.w    ALL_GADS_OFF
  1005.  
  1006.     bsr.w    BUILD_STRUCTURE
  1007.     beq.s    PS_FAIL
  1008.  
  1009.     moveq    #GAD_BASETEXT,d0
  1010.     lsl.w    #2,d0
  1011.     lea    GadgetList,a0
  1012.     move.l    (a0,d0.w),a0
  1013.     move.l    _Window,a1
  1014.     sub.l    a2,a2
  1015.     lea    BaseTextTags,a3
  1016.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1017.  
  1018.     move.l    NoFiles,d7
  1019.     SETTAG    #NoFilesTags,GTNM_Number,d7
  1020.  
  1021.     moveq    #GAD_NOFILES,d0
  1022.     lsl.w    #2,d0
  1023.     lea    GadgetList,a0
  1024.     move.l    (a0,d0.w),a0
  1025.     move.l    _Window,a1
  1026.     sub.l    a2,a2
  1027.     lea    NoFilesTags,a3
  1028.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1029.  
  1030.     SETTAG    #ReqPlaceTags,GTNM_Number,ReqPlaceLow
  1031.  
  1032.     moveq    #GAD_REQPLACE,d0
  1033.     lsl.w    #2,d0
  1034.     lea    GadgetList,a0
  1035.     move.l    (a0,d0.w),a0
  1036.     move.l    _Window,a1
  1037.     sub.l    a2,a2
  1038.     lea    ReqPlaceTags,a3
  1039.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1040.  
  1041.     SETTAG    #PlaceUseTags,GTNM_Number,PlacesUsed
  1042.  
  1043.     moveq    #GAD_PLACEUSE,d0
  1044.     lsl.w    #2,d0
  1045.     lea    GadgetList,a0
  1046.     move.l    (a0,d0.w),a0
  1047.     move.l    _Window,a1
  1048.     sub.l    a2,a2
  1049.     lea    PlaceUseTags,a3
  1050.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1051.  
  1052.     moveq    #GAD_RANGE,d0
  1053.     lsl.w    #2,d0
  1054.     lea    GadgetList,a0
  1055.     move.l    (a0,d0.w),a0
  1056.     move.l    _Window,a1
  1057.     sub.l    a2,a2
  1058.     lea    RangeTags,a3
  1059.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1060.     bsr.w    ALL_GADS_ON
  1061.     rts
  1062.  
  1063. PS_FAIL:
  1064.     moveq    #GAD_PSTRING,d0        ; put pathname in string-gadget
  1065.     lsl.w    #2,d0
  1066.     lea    GadgetList,a0
  1067.     move.l    (a0,d0.w),a0
  1068.     move.l    a0,a4
  1069.     move.l    _Window,a1
  1070.     sub.l    a2,a2
  1071.     lea    PStringTags,a3
  1072.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1073.  
  1074.     SETTAG    #NoFilesTags,GTNM_Number,#0
  1075.  
  1076.     moveq    #GAD_NOFILES,d0
  1077.     lsl.w    #2,d0
  1078.     lea    GadgetList,a0
  1079.     move.l    (a0,d0.w),a0
  1080.     move.l    _Window,a1
  1081.     sub.l    a2,a2
  1082.     lea    NoFilesTags,a3
  1083.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1084.  
  1085.     bsr.w    ALL_GADS_ON
  1086.  
  1087.     move.l    a4,a0
  1088.     move.l    _Window,a1
  1089.     sub.l    a2,a2
  1090.     CALL    ActivateGadget,_IntuitionBase
  1091.     rts
  1092.  
  1093. ;---------------------------------------------------------------------------
  1094.  
  1095. NEWBASE_STRING:
  1096.     move.l    gg_SpecialInfo(a1),a2
  1097.     move.l    si_Buffer(a2),a2
  1098.     move.l    a2,a3
  1099.     
  1100. .ILL:    move.b    (a3)+,d0
  1101.     beq.s    .DONE
  1102.  
  1103.     lea    IllegalChars,a4        ; check for illegal chars
  1104. .LOOP:    move.b    (a4)+,d1
  1105.     beq.s    .ILL
  1106.  
  1107.     cmp.b    d0,d1
  1108.     bne.s    .LOOP
  1109.  
  1110.     move.l    _WBScr,a0
  1111.     CALL    DisplayBeep,_IntuitionBase
  1112.  
  1113.     moveq    #GAD_NEWBASE,d0
  1114.     lsl.w    #2,d0
  1115.     lea    GadgetList,a0
  1116.     move.l    (a0,d0.w),a0
  1117.     move.l    a0,a4
  1118.     move.l    _Window,a1
  1119.     sub.l    a2,a2
  1120.     lea    ChangeStrTags,a3
  1121.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1122.  
  1123.     move.l    a4,a0
  1124.     move.l    _Window,a1
  1125.     sub.l    a2,a2
  1126.     CALL    ActivateGadget,_IntuitionBase
  1127.     rts
  1128.  
  1129. .DONE:    lea    BaseString,a3
  1130. .LOOP2:    move.b    (a2)+,(a3)+
  1131.     bne.s    .LOOP2
  1132.  
  1133.     tst.l    PreDefBase
  1134.     beq.s    .NOT
  1135.  
  1136.     lea    BaseString,a0
  1137.     lea    FileBase,a1
  1138.     move.w    #-1,d7
  1139. .LOOP3:    addq.w    #1,d7
  1140.     move.b    (a0)+,(a1)+
  1141.     bne.s    .LOOP3
  1142.  
  1143.     move.w    d7,PreBaseLen
  1144. .NOT:    rts
  1145.  
  1146. ;-------------------------------------------------------------------------
  1147.  
  1148. PLACES_INTEGER:
  1149.     move.l    gg_SpecialInfo(a1),a2
  1150.     move.l    si_LongInt(a2),d7
  1151.     ble.s    .NULL
  1152.  
  1153.     cmp.l    #PLACESLEN,d7
  1154.     ble.s    OK_INTP
  1155.  
  1156. .NULL:    move.l    _WBScr,a0
  1157.     CALL    DisplayBeep,_IntuitionBase
  1158.  
  1159.     move.l    PlacesValue,d7
  1160.     SETTAG    #ChangeIntTags,GTIN_Number,d7
  1161.  
  1162.     moveq    #GAD_PLACES,d0
  1163.     lsl.w    #2,d0
  1164.     lea    GadgetList,a0
  1165.     move.l    (a0,d0.w),a0
  1166.     move.l    a0,a4
  1167.     move.l    _Window,a1
  1168.     sub.l    a2,a2
  1169.     lea    ChangeIntTags,a3
  1170.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1171.  
  1172.     move.l    a4,a0
  1173.     move.l    _Window,a1
  1174.     sub.l    a2,a2
  1175.     CALL    ActivateGadget,_IntuitionBase
  1176.  
  1177. OK_INTP:
  1178.     move.l    d7,PlacesValue
  1179.     rts
  1180.  
  1181. ;-----------------------------------------------------------------------------
  1182.  
  1183. START_INTEGER:
  1184.     move.l    gg_SpecialInfo(a1),a2
  1185.     move.l    si_LongInt(a2),d7
  1186.     bge.s    OK_INTS
  1187.  
  1188.     move.l    _WBScr,a0
  1189.     CALL    DisplayBeep,_IntuitionBase
  1190.  
  1191.     move.l    StartValue,d7
  1192.     SETTAG    #ChangeIntTags,GTIN_Number,d7
  1193.  
  1194.     moveq    #GAD_PLACES,d0
  1195.     lsl.w    #2,d0
  1196.     lea    GadgetList,a0
  1197.     move.l    (a0,d0.w),a0
  1198.     move.l    a0,a4
  1199.     move.l    _Window,a1
  1200.     sub.l    a2,a2
  1201.     lea    ChangeIntTags,a3
  1202.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1203.  
  1204.     move.l    a4,a0
  1205.     move.l    _Window,a1
  1206.     sub.l    a2,a2
  1207.     CALL    ActivateGadget,_IntuitionBase
  1208.  
  1209. OK_INTS:
  1210.     move.l    d7,StartValue
  1211.     rts
  1212.  
  1213. ;-----------------------------------------------------------------------------
  1214.  
  1215. LEADING_CYCLE:
  1216.     move.w    im_Code(a0),UseLeading
  1217.     rts
  1218.  
  1219. ;-----------------------------------------------------------------------------
  1220.  
  1221. CONVERT_BUTTON:
  1222.     bsr.w    ALL_GADS_OFF
  1223.  
  1224.     move.l    _Window,a0
  1225.     lea    ArudWorking,a1
  1226.     lea    ArudScrTitle,a2
  1227.     CALL    SetWindowTitles,_IntuitionBase
  1228.  
  1229.     lea    ArudList,a0
  1230.     TSTLIST    a0
  1231.     beq.s    NOC_LIST
  1232.  
  1233.     lea    BaseString,a0
  1234.     tst.b    (a0)
  1235.     beq.s    NOC_BASE
  1236.  
  1237.     move.l    ReqPlaceLow,d0
  1238.     move.l    PlacesValue,d1
  1239.     cmp.l    d1,d0
  1240.     bgt.s    NOC_PLACES
  1241.  
  1242.     move.l    StartValue,d7
  1243.     add.l    NoFiles,d7
  1244.     lea    DummyString,a2
  1245.     bsr.w    NUM2TXT
  1246.     move.l    d6,ReqPlaceNew        ; required places!!!
  1247.  
  1248.     move.l    PlacesValue,d1
  1249.     cmp.l    d1,d6
  1250.     bgt.s    NOC_PLACES
  1251.  
  1252. ;--------------------------------------------------------------------
  1253.  
  1254.     lea    ArudList,a0
  1255. CONVERT_LOOP:
  1256.     TSTNODE    a0,a1
  1257.     beq.s    CONVERT_DONE
  1258.  
  1259. ;--------------------------------------------------------------------
  1260.  
  1261.     tst.w    ReverseFlag
  1262.     bne.s    .REVERSE
  1263.  
  1264.     move.l    af_Count(a1),d0
  1265.     sub.l    SmallestNo,d0
  1266.     add.l    StartValue,d0            ; new count for this number.
  1267.     bra.s    .NEWVAL
  1268.  
  1269. .REVERSE:                    ; reverse renaming
  1270.     move.l    af_Count(a1),d0
  1271.  
  1272.     move.l    StartValue,d1
  1273.     add.l    NoFiles,d1
  1274.     subq.l    #1,d1                ; highest value
  1275.  
  1276.     move.l    SmallestNo,d2
  1277.     sub.l    d0,d2
  1278.     add.l    d1,d2
  1279.     move.l    d2,d0
  1280.  
  1281. ;--------------------------------------------------------------------
  1282.  
  1283. .NEWVAL:
  1284.     lea    BaseString,a2
  1285.     lea    Filename,a3
  1286. .COPY:    move.b    (a2)+,(a3)+
  1287.     bne.s    .COPY
  1288.  
  1289.     lea    -1(a3),a3
  1290.  
  1291.     lea    DummyString,a4
  1292.     move.l    PlacesValue,d7
  1293.     move.b    #0,(a4,d7.w)
  1294.     subq.w    #1,d7
  1295. .NUMTXT:
  1296.     divu    #10,d0
  1297.     swap    d0
  1298.     add.b    #'0',d0
  1299.     move.b    d0,(a4,d7.w)
  1300.     clr.w    d0
  1301.     swap    d0
  1302.     dbf    d7,.NUMTXT
  1303.  
  1304. ;--------------------------------------------------------------------
  1305.  
  1306.     tst.w    UseLeading
  1307.     bne.s    .COPY2
  1308.  
  1309. .SEEK:    cmp.b    #'0',(a4)
  1310.     bne.s    .ZERO
  1311.  
  1312.     lea    1(a4),a4
  1313.     bra.s    .SEEK
  1314.  
  1315. .ZERO:    tst.b    (a4)
  1316.     bne.s    .COPY2
  1317.  
  1318.     lea    -1(a4),a4
  1319.  
  1320. .COPY2:    move.b    (a4)+,(a3)+
  1321.     bne.s    .COPY2
  1322.  
  1323. ;--------------------------------------------------------------------
  1324.     
  1325.     move.l    af_Name(a1),d1
  1326.     move.l    #Filename,d2
  1327.  
  1328.     movem.l    a0/a1,-(a7)
  1329.  
  1330.     tst.w    ActionFlag        ; rename or copy files?
  1331.     bne.s    COPY_FILE
  1332.  
  1333. RENAME_FILE:
  1334.     CALL    Rename,_DOSBase
  1335.     bra.s    ACTION_DONE
  1336.  
  1337. COPY_FILE:
  1338.     bsr.w    ACTION_COPY_FILE
  1339.  
  1340. ACTION_DONE:
  1341.     movem.l    (a7)+,a0/a1
  1342.  
  1343.     tst.l    d0
  1344.     beq.s    RENAME_ERROR
  1345.  
  1346. ;--------------------------------------------------------------------
  1347.  
  1348.     move.l    af_Name(a1),a2
  1349.     move.l    a2,d1
  1350. .SRCH:    tst.b    (a2)+
  1351.     bne.s    .SRCH
  1352.  
  1353.     lea    -1(a2),a2
  1354.     lea    InfoString,a3
  1355. .COPY3:    move.b    (a3)+,(a2)+
  1356.     bne.s    .COPY3
  1357.  
  1358.     movem.l    a0/a1,-(a7)
  1359.  
  1360.     move.l    #ACCESS_READ,d2
  1361.     CALL    Lock,_DOSBase
  1362.     tst.l    d0
  1363.     bne.s    .UNL
  1364.  
  1365.     movem.l    (a7)+,a0/a1
  1366.     bra.s    CONTINUE
  1367.  
  1368. .UNL:    move.l    d0,d1
  1369.     CALL    UnLock,_DOSBase
  1370.  
  1371.     movem.l    (a7)+,a0/a1
  1372.  
  1373. ;--------------------------------------------------------------------
  1374.  
  1375.     lea    Filename,a2
  1376. .SRCH2:    tst.b    (a2)+
  1377.     bne.s    .SRCH2
  1378.  
  1379.     lea    -1(a2),a2
  1380.  
  1381.     lea    InfoString,a3
  1382. .COPY4:    move.b    (a3)+,(a2)+
  1383.     bne.s    .COPY4
  1384.  
  1385. ;--------------------------------------------------------------------
  1386.  
  1387.     move.l    af_Name(a1),d1
  1388.     move.l    #Filename,d2
  1389.  
  1390.     movem.l    a0/a1,-(a7)
  1391.  
  1392.     tst.w    ActionFlag        ; rename or copy files?
  1393.     bne.s    COPY_INFO
  1394.  
  1395. RENAME_INFO:
  1396.     CALL    Rename,_DOSBase
  1397.     bra.s    ACTION_DONE2
  1398.  
  1399. COPY_INFO:
  1400.     bsr.w    ACTION_COPY_FILE
  1401.  
  1402. ACTION_DONE2:
  1403.     movem.l    (a7)+,a0/a1
  1404.  
  1405.     tst.l    d0
  1406.     beq.s    RENAME_ERROR
  1407.  
  1408. CONTINUE:
  1409.     move.l    a1,a0
  1410.     bra.s    CONVERT_LOOP
  1411.  
  1412. ;--------------------------------------------------------------------
  1413.  
  1414. CONVERT_DONE:
  1415.     move.l    _Window,a0
  1416.     lea    ArudTitle,a1
  1417.     lea    ArudScrTitle,a2
  1418.     CALL    SetWindowTitles,_IntuitionBase
  1419.  
  1420.     bsr.w    ALL_GADS_ON
  1421.     rts
  1422.  
  1423. ;--------------------------------------------------------------------
  1424.  
  1425. ACTION_COPY_FILE:
  1426.     move.l    d1,d6            ; from
  1427.     move.l    d2,d7            ; to
  1428.  
  1429.     bsr.w    FREE_FIB
  1430.  
  1431.     moveq    #DOS_FIB,d1
  1432.     moveq    #0,d2
  1433.     CALL    AllocDosObject,_DOSBase
  1434.     move.l    d0,_FIB
  1435.     beq.s    COPY_FAIL
  1436.  
  1437.     move.l    d6,d1
  1438.     move.l    #MODE_OLDFILE,d2
  1439.     CALL    Open,_DOSBase
  1440.     move.l    d0,_CopyFile
  1441.     beq.s    COPY_FAIL
  1442.  
  1443.     move.l    d0,d1
  1444.     move.l    _FIB,d2
  1445.     CALL    ExamineFH,_DOSBase
  1446.  
  1447.     move.l    _FIB,a0
  1448.     move.l    fib_Size(a0),d4
  1449.     addq.l    #1,d4
  1450.     move.l    d4,d0
  1451.     move.l    #MEMF_ANY,d1
  1452.     EXEC    AllocVec
  1453.     move.l    d0,_FileBuffer
  1454.     beq.s    COPY_FAIL
  1455.  
  1456.     subq.l    #1,d4
  1457.  
  1458.     move.l    _CopyFile,d1
  1459.     move.l    _FileBuffer,d2
  1460.     move.l    d4,d3
  1461.     CALL    Read,_DOSBase
  1462.     cmp.l    d0,d4
  1463.     bne.s    COPY_FAIL
  1464.  
  1465.     bsr.s    FREE_COPYFILE
  1466.  
  1467.     cmp.w    #2,ActionFlag            ; Copy to?
  1468.     bne.s    .NOT
  1469.  
  1470.     move.l    CPathStart,a0
  1471.     move.l    #Filename,a1
  1472. .CPY:    move.b    (a1)+,(a0)+
  1473.     bne.s    .CPY
  1474.  
  1475.     move.l    #CopyToPath,d7
  1476.  
  1477. .NOT:    move.l    d7,d1
  1478.     move.l    #MODE_NEWFILE,d2
  1479.     CALL    Open,_DOSBase
  1480.     move.l    d0,_CopyFile
  1481.     beq.s    COPY_FAIL
  1482.  
  1483.     move.l    d0,d1
  1484.     move.l    _FileBuffer,d2
  1485.     move.l    d4,d3
  1486.     CALL    Write,_DOSBase
  1487.  
  1488.     bsr.w    FREE_COPYFILE
  1489.     bsr.w    FREE_FILEBUFFER
  1490.     moveq    #1,d0
  1491.     rts
  1492.  
  1493. COPY_FAIL:
  1494.     bsr.w    FREE_COPYFILE
  1495.     bsr.w    FREE_FILEBUFFER
  1496.     moveq    #0,d0
  1497.     rts
  1498.  
  1499. ;--------------------------------------------------------------------
  1500.  
  1501. FREE_COPYFILE:
  1502.     tst.l    _CopyFile
  1503.     beq.s    .NOT
  1504.  
  1505.     move.l    _CopyFile,d1
  1506.     CALL    Close,_DOSBase
  1507.     move.l    #0,_CopyFile
  1508. .NOT:    rts
  1509.  
  1510. FREE_FILEBUFFER:
  1511.     tst.l    _FileBuffer
  1512.     beq.s    .NOT
  1513.  
  1514.     move.l    _FileBuffer,a1
  1515.     EXEC    FreeVec
  1516.     move.l    #0,_FileBuffer
  1517. .NOT:    rts
  1518.  
  1519. ;--------------------------------------------------------------------
  1520.  
  1521. RENAME_ERROR:
  1522.     CALL    IoErr,_DOSBase
  1523.  
  1524.     cmp.l    #ERROR_OBJECT_IN_USE,d0
  1525.     beq.s    NOC_INUSE
  1526.     cmp.l    #ERROR_OBJECT_EXISTS,d0
  1527.     beq.s    NOC_EXISTS
  1528.     cmp.l    #ERROR_OBJECT_NOT_FOUND,d0
  1529.     beq.s    NOC_NOTFOUND
  1530.  
  1531.     lea    ERRRename,a1
  1532.     bsr.s    DISPLAY_REQUESTER
  1533.     rts
  1534.  
  1535. ;--------------------------------------------------------------------
  1536.  
  1537. NOC_INUSE:
  1538.     lea    ERRInUse,a1
  1539.     bsr.s    DISPLAY_REQUESTER
  1540.     rts
  1541.  
  1542. NOC_EXISTS:
  1543.     lea    ERRExists,a1
  1544.     bsr.s    DISPLAY_REQUESTER
  1545.     rts
  1546.  
  1547. NOC_NOTFOUND:
  1548.     lea    ERRNotFound,a1
  1549.     bsr.s    DISPLAY_REQUESTER
  1550.     rts
  1551.  
  1552. ;--------------------------------------------------------------------
  1553.  
  1554. NOC_BASE:
  1555.     lea    ERRNoBase,a1
  1556.     bsr.s    DISPLAY_REQUESTER
  1557.     rts
  1558.  
  1559. NOC_LIST:
  1560.     lea    ERRNoList,a1
  1561.     bsr.s    DISPLAY_REQUESTER
  1562.     rts
  1563.  
  1564. NOC_PLACES:
  1565.     lea    ERRCheckPlaces,a1
  1566.     bsr.s    DISPLAY_REQUESTER
  1567.     rts
  1568.  
  1569. DISPLAY_REQUESTER:
  1570.     move.l    a1,-(a7)
  1571.     move.l    _Window,a0
  1572.     lea    ArudTitle,a1
  1573.     sub.l    a2,a2
  1574.     CALL    SetWindowTitles,_IntuitionBase
  1575.     move.l    (a7)+,a1
  1576.  
  1577.     lea    GADText_Ok,a2
  1578.     move.l    _InfoReq,a3
  1579.     sub.l    a4,a4
  1580.     lea    EZReqTags,a0
  1581.     CALL    rtEZRequestA,_ReqToolsBase
  1582.  
  1583.     bsr.w    ALL_GADS_ON
  1584.     rts
  1585.  
  1586. ;-----------------------------------------------------------------------------
  1587.  
  1588. QUIT_BUTTON:
  1589.     move.w    #1,ExitFlag
  1590.     rts
  1591.  
  1592. ;-----------------------------------------------------------------------------
  1593.  
  1594. FORCE_CYCLE:
  1595.     moveq    #0,d0
  1596.     move.w    im_Code(a0),d0
  1597.     move.l    d0,PreDefBase
  1598.     beq.s    PREDEF_OFF
  1599.  
  1600.     lea    BaseString,a0
  1601.     tst.b    (a0)
  1602.     beq.s    PREDEF_NOSTRING
  1603.  
  1604.     lea    FileBase,a1
  1605.     move.w    #-1,d7
  1606. .LOOP:    addq.w    #1,d7
  1607.     move.b    (a0)+,(a1)+
  1608.     bne.s    .LOOP
  1609.  
  1610.     move.w    d7,PreBaseLen
  1611.     rts
  1612.  
  1613. PREDEF_OFF:
  1614.     lea    FileBase,a0
  1615.     move.b    #0,(a0)
  1616.     rts
  1617.  
  1618. PREDEF_NOSTRING:
  1619.     clr.l    PreDefBase
  1620.  
  1621.     lea    FileBase,a0
  1622.     move.b    #0,(a0)
  1623.  
  1624.     move.l    _WBScr,a0
  1625.     CALL    DisplayBeep,_IntuitionBase
  1626.  
  1627.     moveq    #GAD_FORCE,d0
  1628.     lsl.w    #2,d0
  1629.     lea    GadgetList,a0
  1630.     move.l    (a0,d0.w),a0
  1631.     move.l    a0,a4
  1632.     move.l    _Window,a1
  1633.     sub.l    a2,a2
  1634.     lea    ForceTags,a3
  1635.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1636.     rts
  1637.  
  1638. ;-------------------------------------------------------------------
  1639.  
  1640. DIRECT_CYCLE:
  1641.     move.w    im_Code(a0),ReverseFlag
  1642.     rts
  1643.  
  1644. ;--------------------------------------------------------------------
  1645.  
  1646. ACTION_CYCLE:
  1647.     move.w    im_Code(a0),ActionFlag
  1648.     cmp.w    #2,ActionFlag
  1649.     bne.s    SAME_PATH
  1650.  
  1651.     bsr.w    ALL_GADS_OFF
  1652.  
  1653.     move.l    _FileReq,a1
  1654.     sub.l    a2,a2
  1655.     lea    ArudTitle,a3
  1656.     lea    FileReqTags,a0
  1657.     CALL    rtFileRequestA,_ReqToolsBase
  1658.     tst.l    d0
  1659.     beq.s    SET_ACT_RENAME
  1660.  
  1661.     move.l    _FileReq,a0
  1662.     move.l    rtfi_Dir(a0),a0        ; copy result to buffer
  1663.     lea    CopyToPath,a1
  1664. .LOOP:    move.b    (a0)+,(a1)+
  1665.     bne.s    .LOOP
  1666.  
  1667.     lea    -1(a1),a1
  1668.     move.l    a1,CPathStart        ; this is where the filename
  1669.                     ; starts
  1670.  
  1671.     cmp.b    #':',-1(a1)
  1672.     beq.s    NO_ACT_PATH
  1673.  
  1674.     cmp.b    #'/',-1(a1)
  1675.     beq.s    NO_ACT_PATH
  1676.  
  1677.     move.b    #'/',(a1)+
  1678.     move.l    a1,CPathStart
  1679.  
  1680. NO_ACT_PATH:
  1681.     bsr.w    ALL_GADS_ON
  1682.     rts
  1683.  
  1684. SET_ACT_RENAME:
  1685.     SETTAG    #ActionTags,GTCY_Active,#0
  1686.  
  1687.     moveq    #GAD_ACTION,d0
  1688.     lsl.w    #2,d0
  1689.     lea    GadgetList,a0
  1690.     move.l    (a0,d0.w),a0
  1691.     move.l    a0,a4
  1692.     move.l    _Window,a1
  1693.     sub.l    a2,a2
  1694.     lea    ActionTags,a3
  1695.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  1696.  
  1697.     move.w    #0,ActionFlag
  1698.  
  1699.     bsr.w    ALL_GADS_ON
  1700.     rts
  1701.  
  1702. SAME_PATH:
  1703.     move.l    #0,CPathStart
  1704.     rts
  1705.  
  1706. ;--------------------------------------------------------------------
  1707.  
  1708. CURRENT_DIRECTORY:            ; d7=pathname
  1709.     tst.l    _CDLock
  1710.     beq.s    .LOCK
  1711.  
  1712.     move.l    _CDLock,d1
  1713.     CALL    UnLock,_DOSBase
  1714.     move.l    #0,_CDLock
  1715.  
  1716. .LOCK:    move.l    d7,d1
  1717.     move.l    #ACCESS_READ,d2
  1718.     CALL    Lock,_DOSBase
  1719.     move.l    d0,_CDLock
  1720.     bne.s    .OKLOCK
  1721.  
  1722.     move.l    _WBScr,a0
  1723.     CALL    DisplayBeep,_IntuitionBase
  1724.     moveq    #0,d0
  1725.     rts
  1726.  
  1727. .OKLOCK:
  1728.     move.l    d0,d1
  1729.     CALL    CurrentDir,_DOSBase
  1730.  
  1731.     tst.w    CurrentDone
  1732.     bne.s    .PRGCD
  1733.  
  1734.     move.l    d0,_OldCurrent
  1735.     move.w    #1,CurrentDone
  1736.  
  1737. .PRGCD:    moveq    #1,d0
  1738.     rts
  1739.  
  1740. ;-----------------------------------------------------------------------------
  1741.     
  1742. BUILD_STRUCTURE:
  1743.     bsr.w    FREE_LIST
  1744.     bsr.w    FREE_FIB
  1745.  
  1746.     move.w    #0,HasStructure
  1747.     move.l    #$fffffff,SmallestNo
  1748.     move.l    #0,HighestNo
  1749.     move.l    #0,NoFiles
  1750.     move.l    #0,PlacesUsed
  1751.  
  1752.     bsr.w    RESET_GADGETS
  1753.  
  1754.     moveq    #GAD_FORCE,d0
  1755.     lsl.w    #2,d0
  1756.     lea    GadgetList,a0
  1757.     move.l    (a0,d0.w),a0
  1758.     move.l    _Window,a1
  1759.     sub.l    a2,a2
  1760.     lea    ForceAttrTags,a3
  1761.     CALL    GT_GetGadgetAttrsA,_GadToolsBase
  1762.  
  1763.     moveq    #DOS_FIB,d1
  1764.     moveq    #0,d2
  1765.     CALL    AllocDosObject,_DOSBase
  1766.     move.l    d0,_FIB
  1767.     beq.s    BUILD_FAIL
  1768.  
  1769.     move.l    _CDLock,d1
  1770.     move.l    _FIB,d2
  1771.     CALL    Examine,_DOSBase
  1772.     beq.s    BUILD_FAIL    
  1773.  
  1774. BUILD_LOOP:
  1775.     move.l    _CDLock,d1
  1776.     move.l    _FIB,d2
  1777.     CALL    ExNext,_DOSBase
  1778.     tst.l    d0
  1779.     beq.s    CHECK_END
  1780.  
  1781.     move.l    _FIB,a0
  1782.     tst.l    fib_DirEntryType(a0)    ; files only
  1783.     bpl.s    BUILD_LOOP
  1784.  
  1785.     lea    fib_FileName(a0),a2
  1786.  
  1787.     tst.l    PreDefBase
  1788.     bne.s    BASE_PREDEF
  1789.  
  1790.     bsr.s    CHECK_NAME        ; check for illegal filename
  1791.     beq.s    BUILD_LOOP
  1792.  
  1793. BASE_PREDEF:
  1794.     move.l    a2,a3
  1795.     lea    FileBase,a4        ; files must have same basename!!
  1796. .SAME:    move.b    (a4)+,d0
  1797.     beq.s    .SOK
  1798.  
  1799.     move.b    (a3)+,d1
  1800.     cmp.b    d0,d1
  1801.     beq.s    .SAME
  1802.     bra.s    BUILD_LOOP
  1803.  
  1804. .SOK:    tst.b    (a3)            ; filename has same base
  1805.     beq.s    BUILD_LOOP
  1806.  
  1807.     moveq    #0,d2
  1808.  
  1809. .CHK2:    move.b    (a3)+,d0        ; ... now check if next part is a
  1810.     beq.s    .USE            ; number...
  1811.     cmp.b    #'0',d0
  1812.     blo.s    BUILD_LOOP
  1813.     cmp.b    #'9',d0        
  1814.     bhi.s    BUILD_LOOP
  1815.  
  1816.     addq.l    #1,d2
  1817.     bra.s    .CHK2
  1818.  
  1819. .USE:    move.l    d2,PlacesUsed        ; max number of places used
  1820.  
  1821.     move.l    #af_SIZEOF,d0
  1822.     move.l    #MEMF_ANY!MEMF_CLEAR,d1
  1823.     EXEC    AllocVec
  1824.     move.l    d0,_CurrentNode
  1825.     beq.s    BUILD_FAIL
  1826.  
  1827.     move.l    #FILELEN+1,d0
  1828.     move.l    #MEMF_ANY!MEMF_CLEAR,d1
  1829.     EXEC    AllocVec
  1830.     tst.l    d0
  1831.     beq.s    BUILD_FAIL
  1832.  
  1833.     move.l    _CurrentNode,a1
  1834.     move.l    d0,af_Name(a1)        ; insert filenameptr into node
  1835.  
  1836.     move.l    d0,a0
  1837.     move.w    #FILELEN-1,d7        ; copy text
  1838.     move.l    a2,a3
  1839. COPY_NAME:
  1840.     move.b    (a2)+,(a0)+
  1841.     beq.s    .DONE
  1842.     dbf    d7,COPY_NAME
  1843.  
  1844. .DONE:    move.w    PreBaseLen,d7
  1845.     lea    (a3,d7.w),a3        ; jump to number-part of string
  1846.  
  1847. MAKE_NUMBER:
  1848.     moveq    #0,d0
  1849.     moveq    #0,d1
  1850. .MAKE:    move.b    (a3)+,d1
  1851.     beq.s    .DONE
  1852.  
  1853.     sub.b    #'0',d1
  1854.     mulu    #10,d0
  1855.     add.w    d1,d0
  1856.     bra.s    .MAKE
  1857.  
  1858. .DONE:    move.l    d0,af_Count(a1)
  1859.  
  1860.     move.l    HighestNo,d1
  1861.     cmp.l    d1,d0
  1862.     blt.s    .LOW
  1863.  
  1864.     move.l    d0,HighestNo
  1865.  
  1866. .LOW:    move.l    SmallestNo,d1
  1867.     cmp.l    d1,d0
  1868.     bgt.s    .BIG
  1869.  
  1870.     move.l    d0,SmallestNo
  1871.  
  1872. .BIG:    lea    ArudList,a0
  1873.     move.l    _CurrentNode,a1        ; insert node into list
  1874.     ADDTAIL
  1875.  
  1876.     add.l    #1,NoFiles
  1877.     bra.s    BUILD_LOOP
  1878.  
  1879. BUILD_FAIL:
  1880.     move.l    #0,_CurrentNode
  1881.     moveq    #0,d0
  1882.     rts
  1883.  
  1884. CHECK_END:
  1885.     CALL    IoErr,_DOSBase
  1886.     cmp.l    #ERROR_NO_MORE_ENTRIES,d0
  1887.     bne.s    BUILD_FAIL
  1888.  
  1889.     lea    ArudList,a0
  1890.     TSTLIST    a0
  1891.     beq.s    BUILD_FAIL
  1892.  
  1893. ; make range-text
  1894.  
  1895.     move.l    SmallestNo,d7        ; smallest in range
  1896.     lea    RangeString,a2
  1897.     bsr.w    NUM2TXT
  1898.  
  1899.     move.b    #'-',-1(a2)
  1900.  
  1901.     move.l    SmallestNo,d7
  1902.     add.l    NoFiles,d7
  1903.     subq.l    #1,d7            ; d7=largest in range
  1904.     bsr.w    NUM2TXT
  1905.  
  1906.     move.b    #0,-1(a2)
  1907.  
  1908.     move.l    NoFiles,d7
  1909.     lea    DummyString,a2
  1910.     bsr.w    NUM2TXT
  1911.     move.l    d6,ReqPlaceLow        ; required places!!!
  1912.  
  1913.     move.w    #1,HasStructure
  1914.     moveq    #1,d0
  1915.     rts
  1916.  
  1917. ;-----------------------------------------------------------------------------
  1918.  
  1919. NUM2TXT:                ; d7=number, a2=string to fill
  1920.     move.l    d7,d0
  1921.     lea    DummyStringE,a0
  1922.  
  1923.     lea    DummyString,a1
  1924.     move.w    #9,d1
  1925. .CLR:    clr.b    (a1)+
  1926.     dbf    d1,.CLR
  1927.  
  1928.     moveq    #0,d6
  1929. .LOOP:    addq.l    #1,d6
  1930.     divu    #10,d0
  1931.     swap    d0
  1932.     add.b    #'0',d0
  1933.     move.b    d0,-(a0)
  1934.     clr.w    d0
  1935.     swap    d0
  1936.     tst.w    d0
  1937.     bne.s    .LOOP
  1938.     move.b    #0,-(a0)
  1939.  
  1940.     lea    DummyString,a1
  1941. .SEEK:    tst.b    (a1)+
  1942.     beq.s    .SEEK
  1943.  
  1944.     lea    -1(a1),a1
  1945. .COPY:    move.b    (a1)+,(a2)+
  1946.     bne.s    .COPY
  1947.     rts                ; d6=places in string used
  1948.  
  1949. ;-----------------------------------------------------------------------------
  1950.  
  1951. CHECK_NAME:            ; only names that end in a number are legal
  1952.     move.l    a2,a3
  1953. .NULL:    tst.b    (a3)+
  1954.     bne.s    .NULL
  1955.  
  1956.     lea    -1(a3),a3
  1957.  
  1958. .CHK:    lea    -1(a3),a3
  1959.     cmp.b    #' ',(a3)
  1960.     beq.s    .CHK
  1961.  
  1962.     cmp.b    #'0',(a3)
  1963.     blo.s    .FAIL
  1964.     cmp.b    #'9',(a3)
  1965.     bhi.s    .FAIL
  1966.  
  1967. .BASE:    lea    -1(a3),a3    ; find last char of basename
  1968.     cmp.b    #'0',(a3)
  1969.     blo.s    .FOUND
  1970.     cmp.b    #'9',(a3)
  1971.     ble.s    .BASE
  1972.  
  1973. .FOUND:    lea    1(a3),a3
  1974.     move.l    a2,a4
  1975.     lea    FileBase,a5
  1976.     moveq    #0,d7        ; length of basename
  1977. .CPY:    move.b    (a4)+,(a5)+
  1978.     addq.w    #1,d7
  1979.     cmp.l    a3,a4
  1980.     bne.s    .CPY
  1981.  
  1982.     move.b    #0,(a5)
  1983.  
  1984.     cmp.w    #BASELEN,d7    ; too many chars used in basename
  1985.     bgt.s    .FAIL
  1986.  
  1987.     move.w    d7,PreBaseLen    ; length of pre-defined basename length
  1988.  
  1989.     move.l    #1,PreDefBase
  1990.     moveq    #1,d0
  1991.     rts
  1992.  
  1993. .FAIL:    moveq    #0,d0
  1994.     rts
  1995.  
  1996. ;-----------------------------------------------------------------------------
  1997.  
  1998. RESET_GADGETS:
  1999.     moveq    #GAD_BASETEXT,d0
  2000.     lsl.w    #2,d0
  2001.     lea    GadgetList,a0
  2002.     move.l    (a0,d0.w),a0
  2003.     move.l    _Window,a1
  2004.     sub.l    a2,a2
  2005.     lea    ClrBTextTags,a3
  2006.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2007.  
  2008.     SETTAG    #ReqPlaceTags,GTNM_Number,#0
  2009.  
  2010.     moveq    #GAD_REQPLACE,d0
  2011.     lsl.w    #2,d0
  2012.     lea    GadgetList,a0
  2013.     move.l    (a0,d0.w),a0
  2014.     move.l    _Window,a1
  2015.     sub.l    a2,a2
  2016.     lea    ReqPlaceTags,a3
  2017.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2018.  
  2019.     SETTAG    #PlaceUseTags,GTNM_Number,#0
  2020.  
  2021.     moveq    #GAD_PLACEUSE,d0
  2022.     lsl.w    #2,d0
  2023.     lea    GadgetList,a0
  2024.     move.l    (a0,d0.w),a0
  2025.     move.l    _Window,a1
  2026.     sub.l    a2,a2
  2027.     lea    PlaceUseTags,a3
  2028.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2029.  
  2030.     SETTAG    #NoFilesTags,GTNM_Number,#0
  2031.  
  2032.     moveq    #GAD_NOFILES,d0
  2033.     lsl.w    #2,d0
  2034.     lea    GadgetList,a0
  2035.     move.l    (a0,d0.w),a0
  2036.     move.l    _Window,a1
  2037.     sub.l    a2,a2
  2038.     lea    NoFilesTags,a3
  2039.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2040.  
  2041.     lea    RangeString,a0
  2042.     move.b    #0,(a0)
  2043.  
  2044.     moveq    #GAD_RANGE,d0
  2045.     lsl.w    #2,d0
  2046.     lea    GadgetList,a0
  2047.     move.l    (a0,d0.w),a0
  2048.     move.l    _Window,a1
  2049.     sub.l    a2,a2
  2050.     lea    RangeTags,a3
  2051.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2052.     rts
  2053.  
  2054. ;-----------------------------------------------------------------------------
  2055.  
  2056. ALL_GADS_ON:
  2057.     lea    AllGads,a5
  2058. .LOOP:    move.l    (a5)+,d0
  2059.     bmi.s    .DONE
  2060.  
  2061.     lsl.w    #2,d0
  2062.     lea    GadgetList,a0
  2063.     move.l    (a0,d0.w),a0
  2064.     move.l    _Window,a1
  2065.     sub.l    a2,a2
  2066.     lea    AllOnTag,a3
  2067.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2068.     bra.s    .LOOP
  2069. .DONE:    rts
  2070.  
  2071. ALL_GADS_OFF:
  2072.     lea    AllGads,a5
  2073. .LOOP:    move.l    (a5)+,d0
  2074.     bmi.s    .DONE
  2075.  
  2076.     lsl.w    #2,d0
  2077.     lea    GadgetList,a0
  2078.     move.l    (a0,d0.w),a0
  2079.     move.l    _Window,a1
  2080.     sub.l    a2,a2
  2081.     lea    AllOffTag,a3
  2082.     CALL    GT_SetGadgetAttrsA,_GadToolsBase
  2083.     bra.s    .LOOP
  2084. .DONE:    rts
  2085.     
  2086.  
  2087. ;-----------------------------------------------------------------------------
  2088.  
  2089.     section    "Data",data
  2090.  
  2091.     IFD    WB
  2092. _WBMsg:        dc.l    0
  2093.     ENDC
  2094.  
  2095. _DOSBase:    dc.l    0
  2096. _GfxBase:    dc.l    0
  2097. _GadToolsBase:    dc.l    0
  2098. _IntuitionBase:    dc.l    0
  2099. _ReqToolsBase:    dc.l    0
  2100. ReqToolsName:    dc.b    "reqtools.library",0
  2101. IntuitionName:    dc.b    "intuition.library",0
  2102. GadToolsName:    dc.b    "gadtools.library",0
  2103. DOSName:    dc.b    "dos.library",0
  2104. GfxName:    dc.b    "graphics.library",0
  2105.         VERSTR
  2106. ProgramName:    dc.b    "Arud Converter V"
  2107.         VER
  2108.         dc.b    "."
  2109.         REV
  2110.         dc.b    0
  2111.         even
  2112.  
  2113. ;----------------------------------------------------------------------------
  2114.  
  2115. WBLock:        dc.w    0
  2116. ExitFlag:    dc.w    0
  2117.  
  2118. _UserPort:    dc.l    0
  2119. _Message:    dc.l    0
  2120.  
  2121. _FileReq:    dc.l    0
  2122. _InfoReq:    dc.l    0
  2123.  
  2124. ;----------------------------------------------------------------------------
  2125.  
  2126. SubJumpTable:    dc.l    PATH_BUTTON
  2127.         dc.l    PATH_STRING
  2128.         dc.l    NO_OP
  2129.         dc.l    NO_OP
  2130.         dc.l    NO_OP
  2131.         dc.l    NO_OP
  2132.         dc.l    NEWBASE_STRING
  2133.         dc.l    PLACES_INTEGER
  2134.         dc.l    START_INTEGER
  2135.         dc.l    LEADING_CYCLE
  2136.         dc.l    CONVERT_BUTTON
  2137.         dc.l    QUIT_BUTTON
  2138.         dc.l    FORCE_CYCLE
  2139.         dc.l    DIRECT_CYCLE
  2140.         dc.l    ACTION_CYCLE
  2141.         dc.l    NO_OP
  2142.  
  2143. ;----------------------------------------------------------------------------
  2144.  
  2145. HasStructure:    dc.w    0
  2146. _CurrentNode:    dc.l    0
  2147. ArudList:    dcb.b    MLH_SIZE,0
  2148.  
  2149. ;----------------------------------------------------------------------------
  2150.  
  2151. CurrentDone:    dc.w    0            ; has CurrentDir() ever
  2152.                         ; been done?
  2153. _OldCurrent:    dc.l    0
  2154. _CDLock:    dc.l    0            ; lock to chosen path
  2155. _FIB:        dc.l    0
  2156.  
  2157. UseLeading:    dc.w    0            ; use leading zeros
  2158. PlacesValue:    dc.l    1            ; number of places
  2159. StartValue:    dc.l    0            ; new start value
  2160.  
  2161. HighestNo:    dc.l    0
  2162. SmallestNo:    dc.l    $fffffff        ; smallest number
  2163. NoFiles:    dc.l    0            ; number of files found
  2164. ReqPlaceLow:    dc.l    0
  2165. ReqPlaceNew:    dc.l    0            ; required places
  2166. PlacesUsed:    dc.l    0
  2167.  
  2168. PreBaseLen:    dc.w    0            ; pre-def basename length
  2169. PreDefBase:    dc.l    0            ; is basename pre-defined?
  2170.  
  2171. ReverseFlag:    dc.w    0            ; order of renaming (reverse)
  2172. ActionFlag:    dc.w    0            ; Rename() or Copy() files
  2173.  
  2174. _CopyFile:    dc.l    0
  2175. _FileBuffer:    dc.l    0
  2176.  
  2177. CPathStart:    dc.l    0
  2178.  
  2179. IllegalChars:    dc.b    ":;*/?'#%",0        ; cannot be used in basename
  2180.  
  2181. PathString:    dcb.b    PATHLEN+1,0
  2182. BaseString:    dcb.b    BASELEN+1,0        ; user defined
  2183. FileBase:    dcb.b    BASELEN+1,0        ; set by 'BUILD_STRUCTURE'
  2184. RangeString:    dcb.b    18,0            ; Range of files
  2185. Filename:    dcb.b    108,0
  2186. CopyToPath:    dcb.b    108,0
  2187.  
  2188. DummyString:    dcb.b    PLACESLEN+1,0        ; dummy string for converting
  2189. DummyStringE:    dc.b    0            ; numbers to decimal text
  2190.  
  2191. InfoString:    dc.b    ".info",0
  2192.  
  2193. ERRNoBase:    dc.b    "No basestring defined.",0
  2194. ERRNoList:    dc.b    "No filelist defined.",0
  2195. ERRCheckPlaces:    dc.b    "Places value too low.",0
  2196. ERRRename:    dc.b    "Copy/Rename error.",0
  2197. ERRInUse:    dc.b    "File is in use.",0
  2198. ERRExists:    dc.b    "File already exists.",0
  2199. ERRNotFound:    dc.b    "File not found! Update filelist.",0
  2200.  
  2201. GADText_Ok:    dc.b    "Ok",0
  2202.         even
  2203.  
  2204. FileReqTags:    dc.l    RT_ReqPos,REQPOS_CENTERWIN
  2205.         dc.l    RT_Window,0
  2206.         dc.l    RTFI_Flags,FREQF_NOFILES
  2207.         dc.l    RTEZ_ReqTitle,ProgramName
  2208.         dc.l    TAG_DONE
  2209.  
  2210. EZReqTags:    dc.l    RT_ReqPos,REQPOS_CENTERWIN
  2211.         dc.l    RT_Window,0
  2212.         dc.l    RTEZ_ReqTitle,ProgramName
  2213.         dc.l    TAG_DONE
  2214.  
  2215. ChangeDirTags:    dc.l    RTFI_Dir,PathString
  2216.         dc.l    TAG_DONE
  2217.  
  2218. ChangeIntTags:    dc.l    GTIN_Number,0
  2219.         dc.l    TAG_DONE
  2220.  
  2221. ChangeStrTags:    dc.l    GTST_String,BaseString
  2222.         dc.l    TAG_DONE
  2223.  
  2224. ForceAttrTags:    dc.l    GTCY_Active,PreDefBase
  2225.         dc.l    TAG_DONE
  2226.  
  2227. ClrBTextTags:    dc.l    GTTX_Text,NULL
  2228.         dc.l    TAG_DONE
  2229.  
  2230. ;----------------------------------------------------------------------------
  2231.  
  2232. _TextAttr:    dc.l    0
  2233. _Font:        dc.l    0
  2234.  
  2235. _VisualInfo:    dc.l    0
  2236. _WBScr:        dc.l    0
  2237. WorkbenchName:    dc.b    "Workbench",0
  2238.         even
  2239.  
  2240. FontHeight:    dc.w    0
  2241. FontWidth:    dc.w    0
  2242. TitleHeight:    dc.w    0
  2243.  
  2244. WindowHeight:    dc.w    0
  2245. WindowWidth:    dc.w    0
  2246.  
  2247. GadgetHeight:    dc.w    0
  2248.  
  2249. _Gad:        dc.l    0
  2250. GadgetList:    dcb.l    SUMGAD,0
  2251.  
  2252. AllGads:    dc.l    GAD_PBUTTON,GAD_PSTRING,GAD_NEWBASE,GAD_PLACES
  2253.         dc.l    GAD_STARTVAL,GAD_LEADING,GAD_CONVERT,GAD_QUIT
  2254.         dc.l    GAD_FORCE,GAD_DIRECTION,GAD_ACTION,-1
  2255.  
  2256. AllOnTag:    dc.l    GA_Disabled,FALSE
  2257.         dc.l    TAG_DONE
  2258.  
  2259. AllOffTag:    dc.l    GA_Disabled,TRUE
  2260.         dc.l    TAG_DONE
  2261.  
  2262. GadgetTags:    dc.l    PButtonTags
  2263.         dc.l    PStringTags
  2264.         dc.l    BaseTextTags
  2265.         dc.l    ReqPlaceTags
  2266.         dc.l    NoFilesTags
  2267.         dc.l    RangeTags
  2268.         dc.l    NewBaseTags
  2269.         dc.l    PlacesTags
  2270.         dc.l    StartValTags
  2271.         dc.l    LeadingTags
  2272.         dc.l    ConvertTags
  2273.         dc.l    QuitTags
  2274.         dc.l    ForceTags
  2275.         dc.l    DirectionTags
  2276.         dc.l    ActionTags
  2277.         dc.l    PlaceUseTags
  2278.         dc.l    0
  2279.  
  2280. PButtonTags:    dc.l    TAG_DONE
  2281. PStringTags:    dc.l    GTST_String,PathString
  2282.         dc.l    GTST_MaxChars,PATHLEN
  2283.         dc.l    GA_TabCycle,FALSE
  2284.         dc.l    TAG_DONE
  2285. BaseTextTags:    dc.l    GTTX_Border,TRUE
  2286.         dc.l    GTTX_Text,FileBase
  2287.         dc.l    TAG_DONE
  2288. ReqPlaceTags:    dc.l    GTNM_Number,0
  2289.         dc.l    GTNM_Border,TRUE
  2290.         dc.l    TAG_DONE
  2291. NoFilesTags:    dc.l    GTNM_Number,0
  2292.         dc.l    GTNM_Border,TRUE
  2293.         dc.l    TAG_DONE
  2294. RangeTags:    dc.l    GTTX_Text,RangeString
  2295.         dc.l    GTTX_Border,TRUE
  2296.         dc.l    TAG_DONE
  2297. NewBaseTags:    dc.l    GTST_MaxChars,BASELEN
  2298.         dc.l    GA_TabCycle,TRUE
  2299.         dc.l    TAG_DONE
  2300. PlacesTags:    dc.l    GTIN_MaxChars,2
  2301.         dc.l    GA_TabCycle,TRUE
  2302.         dc.l    GTIN_Number,1
  2303.         dc.l    TAG_DONE
  2304. StartValTags:    dc.l    GTIN_MaxChars,8
  2305.         dc.l    GA_TabCycle,TRUE
  2306.         dc.l    TAG_DONE
  2307. LeadingTags:    dc.l    GTCY_Labels,LeadingPtrs
  2308.         dc.l    TAG_DONE
  2309. ConvertTags:    dc.l    TAG_DONE
  2310. QuitTags:    dc.l    TAG_DONE
  2311. ForceTags:    dc.l    GTCY_Active,0
  2312.         dc.l    GTCY_Labels,ForcePtrs
  2313. DirectionTags:    dc.l    GTCY_Labels,DirectionPtrs
  2314.         dc.l    TAG_DONE
  2315. ActionTags:    dc.l    GTCY_Active,0
  2316.         dc.l    GTCY_Labels,ActionPtrs
  2317.         dc.l    TAG_DONE
  2318. PlaceUseTags:    dc.l    GTNM_Number,0
  2319.         dc.l    GTNM_Border,TRUE
  2320.         dc.l    TAG_DONE
  2321.  
  2322. GadgetTypes:    dc.l    BUTTON_KIND
  2323.         dc.l    STRING_KIND
  2324.         dc.l    TEXT_KIND
  2325.         dc.l    NUMBER_KIND
  2326.         dc.l    NUMBER_KIND
  2327.         dc.l    TEXT_KIND
  2328.         dc.l    STRING_KIND
  2329.         dc.l    INTEGER_KIND
  2330.         dc.l    INTEGER_KIND
  2331.         dc.l    CYCLE_KIND
  2332.         dc.l    BUTTON_KIND
  2333.         dc.l    BUTTON_KIND
  2334.         dc.l    CYCLE_KIND
  2335.         dc.l    CYCLE_KIND
  2336.         dc.l    CYCLE_KIND
  2337.         dc.l    NUMBER_KIND
  2338.  
  2339. GadgetStructs:    dc.l    PButtonS
  2340.         dc.l    PStringS
  2341.         dc.l    BaseTextS
  2342.         dc.l    ReqPlaceS
  2343.         dc.l    NoFilesS
  2344.         dc.l    RangeS
  2345.         dc.l    NewBaseS
  2346.         dc.l    PlacesS
  2347.         dc.l    StartValS
  2348.         dc.l    LeadingS
  2349.         dc.l    ConvertS
  2350.         dc.l    QuitS
  2351.         dc.l    ForceS
  2352.         dc.l    DirectionS
  2353.         dc.l    ActionS
  2354.         dc.l    PlaceUseS
  2355.         dc.l    0
  2356.  
  2357. PButtonS:    dc.w    0        ; gng_LeftEdge
  2358.         dc.w    0        ; gng_TopEdge
  2359.         dc.w    0        ; gng_Width
  2360.         dc.w    0        ; gng_Height
  2361.         dc.l    PathText    ; gng_GadgetText
  2362.         dc.l    0        ; gng_TextAttr
  2363.         dc.w    GAD_PBUTTON    ; gng_GadgetID
  2364.         dc.l    PLACETEXT_IN    ; gng_Flags
  2365.         dc.l    0        ; gng_VisualInfo
  2366.         dc.l    0        ; gng_UserData
  2367.  
  2368. PathText:    dc.b    "Path",0
  2369.         even
  2370.  
  2371. PStringS:    dc.w    0        ; gng_LeftEdge
  2372.         dc.w    0        ; gng_TopEdge
  2373.         dc.w    0        ; gng_Width
  2374.         dc.w    0        ; gng_Height
  2375.         dc.l    0        ; gng_GadgetText
  2376.         dc.l    0        ; gng_TextAttr
  2377.         dc.w    GAD_PSTRING    ; gng_GadgetID
  2378.         dc.l    0        ; gng_Flags
  2379.         dc.l    0        ; gng_VisualInfo
  2380.         dc.l    0        ; gng_UserData
  2381.  
  2382. PCalcIT:    dc.b    0,0
  2383.         dc.b    0,0
  2384.         dc.w    0,0
  2385.         dc.l    0
  2386.         dc.l    PCalcString
  2387.         dc.l    0
  2388.  
  2389. PCalcString:    dcb.b    PCALCLEN,"a"
  2390.         dc.b    0
  2391.         even
  2392.  
  2393.  
  2394. BaseTextS:    dc.w    0        ; gng_LeftEdge
  2395.         dc.w    0        ; gng_TopEdge
  2396.         dc.w    0        ; gng_Width
  2397.         dc.w    0        ; gng_Height
  2398.         dc.l    BaseTextText    ; gng_GadgetText
  2399.         dc.l    0        ; gng_TextAttr
  2400.         dc.w    GAD_BASETEXT    ; gng_GadgetID
  2401.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2402.         dc.l    0        ; gng_VisualInfo
  2403.         dc.l    0        ; gng_UserData
  2404.  
  2405. BaseTextText:    dc.b    "Basename",0
  2406.         even
  2407.  
  2408. ReqPlaceS:    dc.w    0        ; gng_LeftEdge
  2409.         dc.w    0        ; gng_TopEdge
  2410.         dc.w    0        ; gng_Width
  2411.         dc.w    0        ; gng_Height
  2412.         dc.l    ReqPlaceText    ; gng_GadgetText
  2413.         dc.l    0        ; gng_TextAttr
  2414.         dc.w    GAD_REQPLACE    ; gng_GadgetID
  2415.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2416.         dc.l    0        ; gng_VisualInfo
  2417.         dc.l    0        ; gng_UserData
  2418.  
  2419. ReqPlaceText:    dc.b    "Places needed",0
  2420.         even
  2421.  
  2422. NoFilesS:    dc.w    0        ; gng_LeftEdge
  2423.         dc.w    0        ; gng_TopEdge
  2424.         dc.w    0        ; gng_Width
  2425.         dc.w    0        ; gng_Height
  2426.         dc.l    NoFilesText    ; gng_GadgetText
  2427.         dc.l    0        ; gng_TextAttr
  2428.         dc.w    GAD_NOFILES    ; gng_GadgetID
  2429.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2430.         dc.l    0        ; gng_VisualInfo
  2431.         dc.l    0        ; gng_UserData
  2432.  
  2433. NoFilesText:    dc.b    "Files",0
  2434.         even
  2435.  
  2436. RangeS:        dc.w    0        ; gng_LeftEdge
  2437.         dc.w    0        ; gng_TopEdge
  2438.         dc.w    0        ; gng_Width
  2439.         dc.w    0        ; gng_Height
  2440.         dc.l    RangeText    ; gng_GadgetText
  2441.         dc.l    0        ; gng_TextAttr
  2442.         dc.w    GAD_RANGE    ; gng_GadgetID
  2443.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2444.         dc.l    0        ; gng_VisualInfo
  2445.         dc.l    0        ; gng_UserData
  2446.  
  2447. RangeText:    dc.b    "Range",0
  2448.         even
  2449.  
  2450. NewBaseS:    dc.w    0        ; gng_LeftEdge
  2451.         dc.w    0        ; gng_TopEdge
  2452.         dc.w    0        ; gng_Width
  2453.         dc.w    0        ; gng_Height
  2454.         dc.l    NewBaseText    ; gng_GadgetText
  2455.         dc.l    0        ; gng_TextAttr
  2456.         dc.w    GAD_NEWBASE    ; gng_GadgetID
  2457.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2458.         dc.l    0        ; gng_VisualInfo
  2459.         dc.l    0        ; gng_UserData
  2460.  
  2461. NewBaseText:    dc.b    "Base",0
  2462.         even
  2463.  
  2464. PlacesS:    dc.w    0        ; gng_LeftEdge
  2465.         dc.w    0        ; gng_TopEdge
  2466.         dc.w    0        ; gng_Width
  2467.         dc.w    0        ; gng_Height
  2468.         dc.l    PlacesText    ; gng_GadgetText
  2469.         dc.l    0        ; gng_TextAttr
  2470.         dc.w    GAD_PLACES    ; gng_GadgetID
  2471.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2472.         dc.l    0        ; gng_VisualInfo
  2473.         dc.l    0        ; gng_UserData
  2474.  
  2475. PlacesText:    dc.b    "Places",0
  2476.         even
  2477.  
  2478. StartValS:    dc.w    0        ; gng_LeftEdge
  2479.         dc.w    0        ; gng_TopEdge
  2480.         dc.w    0        ; gng_Width
  2481.         dc.w    0        ; gng_Height
  2482.         dc.l    StartValText    ; gng_GadgetText
  2483.         dc.l    0        ; gng_TextAttr
  2484.         dc.w    GAD_STARTVAL    ; gng_GadgetID
  2485.         dc.l    PLACETEXT_LEFT    ; gng_Flags
  2486.         dc.l    0        ; gng_VisualInfo
  2487.         dc.l    0        ; gng_UserData
  2488.  
  2489. StartValText:    dc.b    "Start value",0
  2490.         even
  2491.  
  2492. LeadingS:    dc.w    0        ; gng_LeftEdge
  2493.         dc.w    0        ; gng_TopEdge
  2494.         dc.w    0        ; gng_Width
  2495.         dc.w    0        ; gng_Height
  2496.         dc.l    0        ; gng_GadgetText
  2497.         dc.l    0        ; gng_TextAttr
  2498.         dc.w    GAD_LEADING    ; gng_GadgetID
  2499.         dc.l    0        ; gng_Flags
  2500.         dc.l    0        ; gng_VisualInfo
  2501.         dc.l    0        ; gng_UserData
  2502.  
  2503. LeadingPtrs:    dc.l    NoLeadingText
  2504.         dc.l    LeadingText
  2505.         dc.l    0
  2506.  
  2507. NoLeadingText:    dc.b    "No leading zeros",0
  2508. LeadingText:    dc.b    "Leading zeros",0
  2509.         even
  2510.  
  2511. ConvertS:    dc.w    0        ; gng_LeftEdge
  2512.         dc.w    0        ; gng_TopEdge
  2513.         dc.w    0        ; gng_Width
  2514.         dc.w    0        ; gng_Height
  2515.         dc.l    ConvertText    ; gng_GadgetText
  2516.         dc.l    0        ; gng_TextAttr
  2517.         dc.w    GAD_CONVERT    ; gng_GadgetID
  2518.         dc.l    PLACETEXT_IN    ; gng_Flags
  2519.         dc.l    0        ; gng_VisualInfo
  2520.         dc.l    0        ; gng_UserData
  2521.  
  2522. ConvertText:    dc.b    "Convert",0
  2523.         even
  2524.  
  2525. QuitS:        dc.w    0        ; gng_LeftEdge
  2526.         dc.w    0        ; gng_TopEdge
  2527.         dc.w    0        ; gng_Width
  2528.         dc.w    0        ; gng_Height
  2529.         dc.l    QuitText    ; gng_GadgetText
  2530.         dc.l    0        ; gng_TextAttr
  2531.         dc.w    GAD_QUIT    ; gng_GadgetID
  2532.         dc.l    PLACETEXT_IN    ; gng_Flags
  2533.         dc.l    0        ; gng_VisualInfo
  2534.         dc.l    0        ; gng_UserData
  2535.  
  2536. QuitText:    dc.b    "Quit",0
  2537.         even
  2538.  
  2539. ForceS:        dc.w    0        ; gng_LeftEdge
  2540.         dc.w    0        ; gng_TopEdge
  2541.         dc.w    0        ; gng_Width
  2542.         dc.w    0        ; gng_Height
  2543.         dc.l    0        ; gng_GadgetText
  2544.         dc.l    0        ; gng_TextAttr
  2545.         dc.w    GAD_FORCE    ; gng_GadgetID
  2546.         dc.l    0        ; gng_Flags
  2547.         dc.l    0        ; gng_VisualInfo
  2548.         dc.l    0        ; gng_UserData
  2549.  
  2550. ForcePtrs:    dc.l    ForceOff
  2551.         dc.l    ForceOn
  2552.         dc.l    0
  2553.  
  2554. ForceOff:    dc.b    "First",0
  2555. ForceOn:    dc.b    "Force",0
  2556.         even
  2557.  
  2558. ForceIT:    dc.b    0,0
  2559.         dc.b    0,0
  2560.         dc.w    0,0
  2561.         dc.l    0
  2562.         dc.l    ForceOn
  2563.         dc.l    0
  2564.  
  2565. DirectionS:    dc.w    0        ; gng_LeftEdge
  2566.         dc.w    0        ; gng_TopEdge
  2567.         dc.w    0        ; gng_Width
  2568.         dc.w    0        ; gng_Height
  2569.         dc.l    0        ; gng_GadgetText
  2570.         dc.l    0        ; gng_TextAttr
  2571.         dc.w    GAD_DIRECTION    ; gng_GadgetID
  2572.         dc.l    0        ; gng_Flags
  2573.         dc.l    0        ; gng_VisualInfo
  2574.         dc.l    0        ; gng_UserData
  2575.  
  2576. DirectionPtrs:    dc.l    DirSame
  2577.         dc.l    DirReverse
  2578.         dc.l    0
  2579.  
  2580. DirSame:    dc.b    "Same Order",0
  2581. DirReverse:    dc.b    "Reversed Order",0
  2582.         even
  2583.  
  2584. ActionS:    dc.w    0        ; gng_LeftEdge
  2585.         dc.w    0        ; gng_TopEdge
  2586.         dc.w    0        ; gng_Width
  2587.         dc.w    0        ; gng_Height
  2588.         dc.l    0        ; gng_GadgetText
  2589.         dc.l    0        ; gng_TextAttr
  2590.         dc.w    GAD_ACTION    ; gng_GadgetID
  2591.         dc.l    0        ; gng_Flags
  2592.         dc.l    0        ; gng_VisualInfo
  2593.         dc.l    0        ; gng_UserData
  2594.  
  2595. ActionPtrs:    dc.l    ActRename
  2596.         dc.l    ActCopy
  2597.         dc.l    ActCopyto
  2598.         dc.l    0
  2599.  
  2600. ActRename:    dc.b    "Rename",0
  2601. ActCopy:    dc.b    "Copy",0
  2602. ActCopyto:    dc.b    "Copy To",0
  2603.         even
  2604.  
  2605. PlaceUseS:    dc.w    0        ; gng_LeftEdge
  2606.         dc.w    0        ; gng_TopEdge
  2607.         dc.w    0        ; gng_Width
  2608.         dc.w    0        ; gng_Height
  2609.         dc.l    0        ; gng_GadgetText
  2610.         dc.l    0        ; gng_TextAttr
  2611.         dc.w    GAD_PLACEUSE    ; gng_GadgetID
  2612.         dc.l    0        ; gng_Flags
  2613.         dc.l    0        ; gng_VisualInfo
  2614.         dc.l    0        ; gng_UserData
  2615.  
  2616. ;----------------------------------------------------------------------
  2617.  
  2618. BevelTags:    dc.l    GT_VisualInfo,0
  2619.         dc.l    TAG_DONE
  2620.  
  2621. ;----------------------------------------------------------------------
  2622.  
  2623. _Window:    dc.l    0
  2624. NewWindowTags:    dc.l    WA_Left,0
  2625.         dc.l    WA_Top,0
  2626.         dc.l    WA_Height,0
  2627.         dc.l    WA_Width,0
  2628.         dc.l    WA_Title,ArudTitle
  2629.         dc.l    WA_ScreenTitle,ArudScrTitle
  2630.         dc.l    WA_DetailPen,0
  2631.         dc.l    WA_BlockPen,1
  2632.         dc.l    WA_Gadgets,0
  2633.         dc.l    WA_DragBar,TRUE
  2634.         dc.l    WA_CloseGadget,TRUE
  2635.         dc.l    WA_DepthGadget,TRUE
  2636.         dc.l    WA_Activate,TRUE
  2637.         dc.l    WA_RMBTrap,TRUE
  2638.         dc.l    WA_IDCMP,IDCMP_CLOSEWINDOW!IDCMP_GADGETUP
  2639.         dc.l    TAG_DONE
  2640.  
  2641. ArudTitle:    dc.b    "Arud Converter V"
  2642.         VER
  2643.         dc.b    "."
  2644.         REV
  2645.         dc.b    0
  2646. ArudScrTitle:    dc.b    "Arud Converter V"
  2647.         VER
  2648.         dc.b    "."
  2649.         REV
  2650.         dc.b    " by Morten Amundsen, 1993-1995.",0
  2651. ArudWorking:    dc.b    "Working...",0
  2652.         even
  2653.  
  2654. TopazAttr:    dc.l    TopazName
  2655.         dc.w    8
  2656.         dc.b    0
  2657.         dc.b    FPF_ROMFONT
  2658.  
  2659. TopazName:    dc.b    "topaz.font",0
  2660.         even
  2661.